mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 14:43:58 +00:00
use is_ident
method
This commit is contained in:
parent
171c3c08fe
commit
725c20e8c5
1 changed files with 2 additions and 2 deletions
|
@ -87,8 +87,8 @@ impl ModPath {
|
||||||
|
|
||||||
/// If this path is a single identifier, like `foo`, return its name.
|
/// If this path is a single identifier, like `foo`, return its name.
|
||||||
pub fn as_ident(&self) -> Option<&Name> {
|
pub fn as_ident(&self) -> Option<&Name> {
|
||||||
if self.kind != PathKind::Plain || self.segments.len() > 1 {
|
if !self.is_ident() {
|
||||||
return None;
|
return None
|
||||||
}
|
}
|
||||||
self.segments.first()
|
self.segments.first()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue