Skip to content

Commit 3c50257

Browse files
authored
Rollup merge of #82030 - LingMan:init_directly, r=varkor
Use `Iterator::all` instead of open-coding it Shorter code and by initializing to the final value directly, the variable doesn't need to be mut.
2 parents 3db4afd + fde59a8 commit 3c50257

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1382,14 +1382,8 @@ fn determine_place_ancestry_relation(
13821382
// Assume of length of projections_b = m
13831383
let projections_b = &place_b.projections;
13841384

1385-
let mut same_initial_projections = true;
1386-
1387-
for (proj_a, proj_b) in projections_a.iter().zip(projections_b.iter()) {
1388-
if proj_a != proj_b {
1389-
same_initial_projections = false;
1390-
break;
1391-
}
1392-
}
1385+
let same_initial_projections =
1386+
projections_a.iter().zip(projections_b.iter()).all(|(proj_a, proj_b)| proj_a == proj_b);
13931387

13941388
if same_initial_projections {
13951389
// First min(n, m) projections are the same

0 commit comments

Comments
 (0)