This commit is contained in:
Protryon 2021-03-24 10:17:54 -07:00
parent daba572d94
commit bbc6121f9d
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ use std::fmt;
/// Returns a reference to bytes from the given input if the given string is equal to the bytes,
/// otherwise returns [`None`].
///
fn eat<'a>(input: &'a [u8], wanted: &str) -> Option<usize> {
fn eat(input: &[u8], wanted: &str) -> Option<usize> {
let wanted = wanted.as_bytes();
if input.len() < wanted.len() {
return None;

View File

@ -91,7 +91,7 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result<Vec<SpannedToken
path,
content: input.subtendril(
line_start as u32,
input[line_start..].find('\n').unwrap_or(input.len()) as u32,
input[line_start..].find('\n').unwrap_or_else(|| input.len()) as u32,
),
},
));