Skip to content

Commit 69a2d98

Browse files
committed
put both usages of op_types in the same closure to satisfy borrowck
1 parent 2166006 commit 69a2d98

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

clippy_lints/src/suspicious_operation_groupings.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ impl EarlyLintPass for SuspiciousOperationGroupings {
7777
// We could use a hashmap, etc. to avoid being O(n*m) here, but
7878
// we want the lints to be emitted in a consistent order. Besides,
7979
// m, (the number of distinct `BinOpKind`s in `binops`)
80-
// will often be small, and does hav an upper limit.
81-
binops.iter().map(|b| b.op).filter(|op| !op_types.contains(op)).for_each(|op| op_types.push(op));
80+
// will often be small, and does have an upper limit.
81+
binops.iter().map(|b| b.op).for_each(|op| {
82+
if !op_types.contains(op) {
83+
op_types.push(op);
84+
}
85+
});
8286

8387
for op_type in op_types {
8488
let ops: Vec<_> = binops.iter().filter(|b| b.op == op_type).collect();

0 commit comments

Comments
 (0)