This commit is contained in:
minish 2025-09-20 00:18:24 -04:00
parent df308cc476
commit 67e701bc7c
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
3 changed files with 6 additions and 4 deletions

View File

@ -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<Cell<u16>> {
let mut cur = Some(self);

View File

@ -166,6 +166,7 @@ where
chars: Peekable<I>,
}
#[allow(clippy::unnecessary_wraps)]
fn t(tk: Token) -> Option<Result<Token>> {
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<Result<Token>> {
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())),
}
}

View File

@ -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::<Vec<_>>()
.join(", "),