Skip to content

Commit

Permalink
Reduce number of effectively equivalent generated closure expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 29, 2024
1 parent e749a20 commit f10c2ea
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions tests/test_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ fn test_permutations() -> ExitCode {
});

// Expr::Closure
f(parse_quote!(|| -> T {}));
iter(depth, &mut |expr| {
f(Expr::Closure(ExprClosure {
attrs: Vec::new(),
Expand All @@ -912,19 +913,6 @@ fn test_permutations() -> ExitCode {
output: ReturnType::Default,
body: Box::new(expr.clone()),
}));
f(Expr::Closure(ExprClosure {
attrs: Vec::new(),
lifetimes: None,
constness: None,
movability: None,
asyncness: None,
capture: None,
or1_token: Token![|](Span::call_site()),
inputs: Punctuated::new(),
or2_token: Token![|](Span::call_site()),
output: ReturnType::Type(Token![->](Span::call_site()), parse_quote!(T)),
body: Box::new(expr),
}));
});

// Expr::Const
Expand Down Expand Up @@ -1198,6 +1186,6 @@ fn test_permutations() -> ExitCode {
};

iter(2, &mut assert);
assert_eq!(count, 134599);
assert_eq!(count, 133539);
status
}

0 comments on commit f10c2ea

Please sign in to comment.