diff options
author | Kevaundray Wedderburn <[email protected]> | 2021-01-18 16:54:07 +0000 |
---|---|---|
committer | Kevaundray Wedderburn <[email protected]> | 2021-01-18 16:54:07 +0000 |
commit | 725c20e8c51aa84a52bbfa96dca7bd999681b541 (patch) | |
tree | 70a72a946a41c78b57df2a1c557183f5ac58aaad /crates/hir_def | |
parent | 171c3c08fe245938fb25321394233de5fe2abc7c (diff) |
use `is_ident` method
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/path.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index e2bf85bbc..61b64f70e 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs | |||
@@ -87,8 +87,8 @@ impl ModPath { | |||
87 | 87 | ||
88 | /// If this path is a single identifier, like `foo`, return its name. | 88 | /// If this path is a single identifier, like `foo`, return its name. |
89 | pub fn as_ident(&self) -> Option<&Name> { | 89 | pub fn as_ident(&self) -> Option<&Name> { |
90 | if self.kind != PathKind::Plain || self.segments.len() > 1 { | 90 | if !self.is_ident() { |
91 | return None; | 91 | return None |
92 | } | 92 | } |
93 | self.segments.first() | 93 | self.segments.first() |
94 | } | 94 | } |