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) { 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>> { fn find(&self, id: &Ident) -> Rc<Cell<u16>> {
let mut cur = Some(self); let mut cur = Some(self);

View File

@ -166,6 +166,7 @@ where
chars: Peekable<I>, chars: Peekable<I>,
} }
#[allow(clippy::unnecessary_wraps)]
fn t(tk: Token) -> Option<Result<Token>> { fn t(tk: Token) -> Option<Result<Token>> {
Some(Ok(tk)) Some(Ok(tk))
} }
@ -203,6 +204,7 @@ where
fn eat(&mut self) { fn eat(&mut self) {
self.next(); self.next();
} }
#[allow(clippy::unnecessary_wraps)]
fn eat_to(&mut self, tk: Token) -> Option<Result<Token>> { fn eat_to(&mut self, tk: Token) -> Option<Result<Token>> {
self.eat(); self.eat();
Some(Ok(tk)) Some(Ok(tk))
@ -236,7 +238,7 @@ where
"true" => Token::Literal(Literal::Boolean(true)), "true" => Token::Literal(Literal::Boolean(true)),
"false" => Token::Literal(Literal::Boolean(false)), "false" => Token::Literal(Literal::Boolean(false)),
"nil" => Token::Literal(Literal::Nil), "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); let mut result = fmt_expr(l, depth);
result.push('('); result.push('(');
let len = r.len(); 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)); result.push_str(&fmt_expr(e, depth));
if i + 1 != len { if i + 1 != len {
result.push_str(", "); result.push_str(", ");
@ -62,7 +62,7 @@ fn fmt_expr(e: &Expr, depth: usize) -> String {
} }
Expr::Func(a, e) => format!( Expr::Func(a, e) => format!(
"(func({}) ({}))", "(func({}) ({}))",
a.into_iter() a.iter()
.map(|e| fmt_expr(e, depth)) .map(|e| fmt_expr(e, depth))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(", "), .join(", "),