mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Simpler acessors for keywords
This commit is contained in:
parent
00ec0c1066
commit
30084a56a5
14 changed files with 128 additions and 1025 deletions
|
@ -23,7 +23,7 @@ use insta::assert_snapshot;
|
|||
use ra_db::{fixture::WithFixture, salsa::Database, FilePosition, SourceDatabase};
|
||||
use ra_syntax::{
|
||||
algo,
|
||||
ast::{self, AstNode, AstToken},
|
||||
ast::{self, AstNode},
|
||||
};
|
||||
use stdx::format_to;
|
||||
|
||||
|
@ -101,7 +101,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
|
|||
let node = src_ptr.value.to_node(&src_ptr.file_syntax(&db));
|
||||
|
||||
let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.clone()) {
|
||||
(self_param.self_kw_token().unwrap().syntax().text_range(), "self".to_string())
|
||||
(self_param.self_token().unwrap().text_range(), "self".to_string())
|
||||
} else {
|
||||
(src_ptr.value.range(), node.text().to_string().replace("\n", " "))
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue