Skip to content

Commit ce47b3c

Browse files
authored
fiat-constify: filter out let mut declarations (#1057)
Avoids unused variable warnings
1 parent 4c583ff commit ce47b3c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fiat-constify/src/main.rs

+15
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,21 @@ fn rewrite_fn_body(stmts: &[Stmt], outputs: &Outputs) -> Vec<Stmt> {
199199
}
200200
} else if let Stmt::Expr(Expr::Call(expr), Some(_)) = stmt {
201201
rewritten.push(Stmt::Local(rewrite_fn_call(expr.clone())));
202+
} else if let Stmt::Local(Local {
203+
pat: Pat::Type(pat),
204+
..
205+
}) = stmt
206+
{
207+
let unboxed = pat.pat.as_ref();
208+
if let Pat::Ident(PatIdent {
209+
mutability: Some(_),
210+
..
211+
}) = unboxed
212+
{
213+
// This is a mut var, in the case of fiat-crypto transformation dead code
214+
} else {
215+
rewritten.push(stmt.clone());
216+
}
202217
} else {
203218
rewritten.push(stmt.clone());
204219
}

0 commit comments

Comments
 (0)