Change all runtime asserts in private functions to debug_assert.
These functions aren't exposed to the public so we can confidently say that if they work in dev then they will work in production. Removing these asserts theoretically should result in a speedup.
This commit is contained in:
parent
6097e4df18
commit
0b2a5f4fbf
@ -106,8 +106,8 @@ fn is_slice_of(parent: &str, child: &str) -> bool {
|
||||
}
|
||||
|
||||
/// Get a slice of the string that was consumed in a parser using the original input to the parser and the remaining input after the parser.
|
||||
pub fn get_consumed<'s>(input: &'s str, remaining: &'s str) -> &'s str {
|
||||
assert!(is_slice_of(input, remaining));
|
||||
fn get_consumed<'s>(input: &'s str, remaining: &'s str) -> &'s str {
|
||||
debug_assert!(is_slice_of(input, remaining));
|
||||
let source = {
|
||||
let offset = remaining.as_ptr() as usize - input.as_ptr() as usize;
|
||||
&input[..offset]
|
||||
|
@ -72,8 +72,8 @@ impl<'s> OrgSource<'s> {
|
||||
}
|
||||
|
||||
pub(crate) fn get_until(&self, other: OrgSource<'s>) -> OrgSource<'s> {
|
||||
assert!(other.start >= self.start);
|
||||
assert!(other.end <= self.end);
|
||||
debug_assert!(other.start >= self.start);
|
||||
debug_assert!(other.end <= self.end);
|
||||
self.slice(..(other.start - self.start))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user