diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-28 22:14:44 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-28 22:14:44 +0000 |
| commit | 0baa1007100fd72ec6c2b5760e3df74bd4da3fa1 (patch) | |
| tree | 3a333433a43e9751604901a2fc612c04d873111f | |
| parent | 77a455303bf08da8eef6236b2b4422a77cd25c42 (diff) | |
| download | rust-0baa1007100fd72ec6c2b5760e3df74bd4da3fa1.tar.gz rust-0baa1007100fd72ec6c2b5760e3df74bd4da3fa1.zip | |
rustc_hir: replace `is_empty()`+indexing with `first()`
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index a396d705cbb..3fea6cdbcf7 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -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) } } |
