Skip to content

Commit 0baa100

Browse files
committed
rustc_hir: replace is_empty()+indexing with first()
1 parent 77a4553 commit 0baa100

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub type UsePath<'hir> = Path<'hir, SmallVec<[Res; 3]>>;
206206

207207
impl Path<'_> {
208208
pub fn is_global(&self) -> bool {
209-
!self.segments.is_empty() && self.segments[0].ident.name == kw::PathRoot
209+
self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
210210
}
211211
}
212212

0 commit comments

Comments
 (0)