mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-19 00:31:19 +00:00
internal: Simplify
This commit is contained in:
parent
312ac83caf
commit
2642f64570
6 changed files with 75 additions and 94 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue