1
Fork 0

rustc_hir: replace is_empty()+indexing with first()

This commit is contained in:
Yotam Ofek 2025-01-28 22:14:44 +00:00
parent 77a455303b
commit 0baa100710

View file

@ -206,7 +206,7 @@ pub type UsePath<'hir> = Path<'hir, SmallVec<[Res; 3]>>;
impl Path<'_> {
pub fn is_global(&self) -> bool {
!self.segments.is_empty() && self.segments[0].ident.name == kw::PathRoot
self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
}
}