lib/scanner: clippy lints

This commit is contained in:
Paul Stemmet 2021-08-14 14:26:03 +00:00 committed by Paul Stemmet
parent 048550a7b1
commit 28a7ce9191
2 changed files with 7 additions and 5 deletions

View file

@ -1182,8 +1182,10 @@ where
/// yaml.org/spec/1.2/spec.html#ns-plain-safe(c)
fn is_plain_safe_c(base: &str, offset: usize, block_context: bool) -> bool
{
block_context
|| ((!block_context) && (!check!(~base, offset => b',' | b'[' | b']' | b'{' | b'}')))
let flow_context = !block_context;
let not_flow_indicator = !check!(~base, offset => b',' | b'[' | b']' | b'{' | b'}');
block_context || (flow_context && not_flow_indicator)
}
/// Vessel for tracking various stats about the underlying

View file

@ -167,8 +167,8 @@ pub(in crate::scanner) fn scan_plain_scalar<'de>(
1 =>
{
// Note that we reset whitespace to zero here, so that the
// post loop truncate doesn't
// remove characters we've already removed here
// post loop truncate doesn't remove characters we've
// already removed here
scratch.truncate(scratch.len() - whitespace);
whitespace = 0;
@ -182,7 +182,7 @@ pub(in crate::scanner) fn scan_plain_scalar<'de>(
// scratch space.
scratch.truncate(scratch.len() - whitespace);
whitespace = 0;
lines = lines - 1;
lines -= 1;
// Safety: we can only reach this branch if lines > 1
for _ in 0..lines