Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/mod_path.rs')
| -rw-r--r-- | crates/hir-expand/src/mod_path.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir-expand/src/mod_path.rs b/crates/hir-expand/src/mod_path.rs index bb2f6350c6..d38e4a52a8 100644 --- a/crates/hir-expand/src/mod_path.rs +++ b/crates/hir-expand/src/mod_path.rs @@ -80,6 +80,12 @@ impl ModPath { self.kind == PathKind::Super(0) && self.segments.is_empty() } + #[allow(non_snake_case)] + pub fn is_Self(&self) -> bool { + self.kind == PathKind::Plain + && matches!(&*self.segments, [name] if *name == known::SELF_TYPE) + } + /// If this path is a single identifier, like `foo`, return its name. pub fn as_ident(&self) -> Option<&Name> { if self.kind != PathKind::Plain { |