get right with clippy

This commit is contained in:
Scott Richmond 2024-11-21 20:00:49 -05:00
parent 72846ccd5c
commit b8f040c6ce
2 changed files with 8 additions and 11 deletions

View File

@ -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())

View File

@ -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<'_> {}