diff --git a/src/compiler.rs b/src/compiler.rs index 5578a9b..3f1187a 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -23,7 +23,7 @@ impl<'a> Scope<'a> { } } fn assigned(&mut self, id: Ident) { - self.idents.push((id, Default::default())); + self.idents.push((id, Rc::default())); } fn find(&self, id: &Ident) -> Rc> { let mut cur = Some(self); diff --git a/src/lexer.rs b/src/lexer.rs index a498fba..40f48ac 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -166,6 +166,7 @@ where chars: Peekable, } +#[allow(clippy::unnecessary_wraps)] fn t(tk: Token) -> Option> { Some(Ok(tk)) } @@ -203,6 +204,7 @@ where fn eat(&mut self) { self.next(); } + #[allow(clippy::unnecessary_wraps)] fn eat_to(&mut self, tk: Token) -> Option> { self.eat(); Some(Ok(tk)) @@ -236,7 +238,7 @@ where "true" => Token::Literal(Literal::Boolean(true)), "false" => Token::Literal(Literal::Boolean(false)), "nil" => Token::Literal(Literal::Nil), - _ => Token::Literal(Literal::Ident(Ident(word), Default::default())), + _ => Token::Literal(Literal::Ident(Ident(word), Option::default())), } } diff --git a/src/parser/util.rs b/src/parser/util.rs index 68c28ff..33324da 100644 --- a/src/parser/util.rs +++ b/src/parser/util.rs @@ -28,7 +28,7 @@ fn fmt_expr(e: &Expr, depth: usize) -> String { let mut result = fmt_expr(l, depth); result.push('('); let len = r.len(); - for (i, e) in r.into_iter().enumerate() { + for (i, e) in r.iter().enumerate() { result.push_str(&fmt_expr(e, depth)); if i + 1 != len { result.push_str(", "); @@ -62,7 +62,7 @@ fn fmt_expr(e: &Expr, depth: usize) -> String { } Expr::Func(a, e) => format!( "(func({}) ({}))", - a.into_iter() + a.iter() .map(|e| fmt_expr(e, depth)) .collect::>() .join(", "),