Skip to content

Commit b67cd4c

Browse files
committed
cleanup: Remove useless [T].iter().last()
1 parent 30017c3 commit b67cd4c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ fn deny_equality_constraints(
17411741
.map(|segment| segment.ident.name)
17421742
.zip(poly.trait_ref.path.segments.iter().map(|segment| segment.ident.name))
17431743
.all(|(a, b)| a == b)
1744-
&& let Some(potential_assoc) = full_path.segments.iter().last()
1744+
&& let Some(potential_assoc) = full_path.segments.last()
17451745
{
17461746
suggest(poly, potential_assoc, predicate);
17471747
}

compiler/rustc_macros/src/diagnostics/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'ty> FieldInnerTy<'ty> {
146146
};
147147

148148
let path = &ty_path.path;
149-
let ty = path.segments.iter().last().unwrap();
149+
let ty = path.segments.last().unwrap();
150150
let syn::PathArguments::AngleBracketed(bracketed) = &ty.arguments else {
151151
panic!("expected bracketed generic arguments");
152152
};

0 commit comments

Comments
 (0)