This commit is contained in:
ConnorSkees 2020-04-01 18:09:58 -04:00
parent 5fb3f52114
commit dd4a48165a
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ impl Op {
/// Do not rely on the number itself, but rather the size relative to other numbers /// 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 /// If precedence is equal, the leftmost operation is evaluated first
pub fn precedence(&self) -> usize { pub fn precedence(self) -> usize {
match self { match self {
Self::And | Self::Or | Self::Not => 0, Self::And | Self::Or | Self::Not => 0,
Self::Equal Self::Equal

View File

@ -330,7 +330,7 @@ impl Value {
} }
} }
Ok(if comma_separated.len() > 0 { Ok(if !comma_separated.is_empty() {
if space_separated.len() == 1 { if space_separated.len() == 1 {
comma_separated.push(space_separated.pop().unwrap()); comma_separated.push(space_separated.pop().unwrap());
} else if !space_separated.is_empty() { } else if !space_separated.is_empty() {
@ -410,7 +410,7 @@ impl Value {
toks.next(); toks.next();
let mut inner = read_until_closing_paren(toks); let mut inner = read_until_closing_paren(toks);
// todo: the above shouldn't eat the closing paren // 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()); return Err("expected \")\".".into());
} }
Ok(IntermediateValue::Paren(inner)) Ok(IntermediateValue::Paren(inner))