mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 18:43:01 +00:00
fix: Cleanup param name inlay hint filtering
This commit is contained in:
parent
fb133c8c80
commit
2b382eb772
7 changed files with 188 additions and 119 deletions
|
|
@ -36,6 +36,16 @@ impl ast::NameRef {
|
|||
pub fn text(&self) -> TokenText<'_> {
|
||||
text_of_first_token(self.syntax())
|
||||
}
|
||||
pub fn text_non_mutable(&self) -> &str {
|
||||
fn first_token(green_ref: &GreenNodeData) -> &GreenTokenData {
|
||||
green_ref.children().next().and_then(NodeOrToken::into_token).unwrap()
|
||||
}
|
||||
|
||||
match self.syntax().green() {
|
||||
Cow::Borrowed(green_ref) => first_token(green_ref).text(),
|
||||
Cow::Owned(_) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_tuple_field(&self) -> Option<usize> {
|
||||
self.text().parse().ok()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue