diff --git a/src/common.rs b/src/common.rs index 03474e4..a8de3ef 100644 --- a/src/common.rs +++ b/src/common.rs @@ -46,7 +46,7 @@ impl Op { /// Do not rely on the number itself, but rather the size relative to other numbers /// /// If precedence is equal, the leftmost operation is evaluated first - pub fn precedence(&self) -> usize { + pub fn precedence(self) -> usize { match self { Self::And | Self::Or | Self::Not => 0, Self::Equal diff --git a/src/value/parse.rs b/src/value/parse.rs index 3f41453..792b8f7 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -330,7 +330,7 @@ impl Value { } } - Ok(if comma_separated.len() > 0 { + Ok(if !comma_separated.is_empty() { if space_separated.len() == 1 { comma_separated.push(space_separated.pop().unwrap()); } else if !space_separated.is_empty() { @@ -410,7 +410,7 @@ impl Value { toks.next(); let mut inner = read_until_closing_paren(toks); // todo: the above shouldn't eat the closing paren - if inner.len() > 0 && inner.pop().unwrap().kind != ')' { + if !inner.is_empty() && inner.pop().unwrap().kind != ')' { return Err("expected \")\".".into()); } Ok(IntermediateValue::Paren(inner))