Skip to content

Commit

Permalink
fiat-constify: filter out let mut declarations (#1057)
Browse files Browse the repository at this point in the history
Avoids unused variable warnings
  • Loading branch information
coder0xff committed Mar 13, 2024
1 parent 4c583ff commit ce47b3c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fiat-constify/src/main.rs
Expand Up @@ -199,6 +199,21 @@ fn rewrite_fn_body(stmts: &[Stmt], outputs: &Outputs) -> Vec<Stmt> {
}
} else if let Stmt::Expr(Expr::Call(expr), Some(_)) = stmt {
rewritten.push(Stmt::Local(rewrite_fn_call(expr.clone())));
} else if let Stmt::Local(Local {
pat: Pat::Type(pat),
..
}) = stmt
{
let unboxed = pat.pat.as_ref();
if let Pat::Ident(PatIdent {
mutability: Some(_),
..
}) = unboxed
{
// This is a mut var, in the case of fiat-crypto transformation dead code
} else {
rewritten.push(stmt.clone());
}
} else {
rewritten.push(stmt.clone());
}
Expand Down

0 comments on commit ce47b3c

Please sign in to comment.