mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Merge #7326
7326: Use `is_ident` when converting Path to an Identifier r=edwin0cheng a=kevaundray Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
This commit is contained in:
commit
fcc109e890
1 changed files with 1 additions and 1 deletions
|
@ -87,7 +87,7 @@ 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…
Add table
Add a link
Reference in a new issue