Skip to content

Commit 6fa49a0

Browse files
fix clippy
1 parent 2607bd7 commit 6fa49a0

File tree

1 file changed

+15
-15
lines changed
  • library/kani_macros/src/sysroot/loop_contracts

1 file changed

+15
-15
lines changed

library/kani_macros/src/sysroot/loop_contracts/mod.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,24 @@ fn transform_break_continue(block: &mut Block) {
234234

235235
fn while_let_rewrite(loopexpr: Stmt) -> Stmt {
236236
if let Stmt::Expr(ref expr, _) = loopexpr {
237-
if let Expr::While(ExprWhile { cond, body, .. }) = expr {
238-
if let Expr::Let(ref let_expr) = **cond {
239-
let pat = &let_expr.pat;
240-
let scrutinee = &let_expr.expr;
241-
242-
// Transform to loop with match
243-
return parse_quote! {
244-
loop {
245-
match #scrutinee {
246-
#pat => #body,
247-
_ => break,
248-
}
249-
};
237+
if let Expr::While(ExprWhile { cond, body, .. }) = expr
238+
&& let Expr::Let(ref let_expr) = **cond
239+
{
240+
let pat = &let_expr.pat;
241+
let scrutinee = &let_expr.expr;
242+
243+
// Transform to loop with match
244+
return parse_quote! {
245+
loop {
246+
match #scrutinee {
247+
#pat => #body,
248+
_ => break,
249+
}
250250
};
251-
}
251+
};
252252
}
253253
}
254-
return loopexpr.clone();
254+
loopexpr.clone()
255255
}
256256

257257
pub fn loop_invariant(attr: TokenStream, item: TokenStream) -> TokenStream {

0 commit comments

Comments
 (0)