diff --git a/src/lexer.rs b/src/lexer.rs index e850398..ad7a4f1 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -15,7 +15,7 @@ pub enum Token<'src> { Punctuation(&'src str), } -impl<'src> fmt::Display for Token<'src> { +impl fmt::Display for Token<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Token::Number(n) => write!(f, "[Number {}]", n), @@ -60,7 +60,7 @@ pub fn lexer<'src>( _ => Token::Word(word), }); - let keyword = just(':').ignore_then(word.clone()).map(Token::Keyword); + let keyword = just(':').ignore_then(word).map(Token::Keyword); let string = just('"') .ignore_then(none_of("\"").repeated().to_slice()) diff --git a/src/value.rs b/src/value.rs index 2e08bca..f9914cf 100644 --- a/src/value.rs +++ b/src/value.rs @@ -48,10 +48,10 @@ impl<'src> Clone for Value<'src> { fn clone(&self) -> Value<'src> { match self { Value::Nil => Value::Nil, - Value::Boolean(b) => Value::Boolean(b.clone()), + Value::Boolean(b) => Value::Boolean(*b), Value::String(s) => Value::String(s), Value::Keyword(s) => Value::Keyword(s), - Value::Number(n) => Value::Number(n.clone()), + Value::Number(n) => Value::Number(*n), Value::Tuple(t) => Value::Tuple(t.clone()), Value::Args(a) => Value::Args(a.clone()), Value::Fn(f) => Value::Fn(f.clone()), @@ -65,7 +65,7 @@ impl<'src> Clone for Value<'src> { } } -impl<'src> fmt::Display for Value<'src> { +impl fmt::Display for Value<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Value::Nil => write!(f, "nil"), @@ -120,12 +120,9 @@ impl<'src> fmt::Display for Value<'src> { } } -impl<'src> Value<'src> { +impl Value<'_> { pub fn bool(&self) -> bool { - match self { - Value::Nil | Value::Boolean(false) => false, - _ => true, - } + matches!(self, Value::Nil | Value::Boolean(false)) } pub fn ludus_type(&self) -> Value { @@ -170,4 +167,4 @@ impl<'src> PartialEq for Value<'src> { } } -impl<'src> Eq for Value<'src> {} +impl Eq for Value<'_> {}