mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Shrink PatPtr by swapping its AstPtr and Either wrap order
This commit is contained in:
parent
a158670432
commit
88a00bf49d
15 changed files with 164 additions and 190 deletions
|
@ -846,9 +846,7 @@ fn location_csv_pat(db: &RootDatabase, vfs: &Vfs, sm: &BodySourceMap, pat_id: Pa
|
|||
Err(SyntheticSyntax) => return "synthetic,,".to_string(),
|
||||
};
|
||||
let root = db.parse_or_expand(src.file_id);
|
||||
let node = src.map(|e| {
|
||||
e.either(|it| it.to_node(&root).syntax().clone(), |it| it.to_node(&root).syntax().clone())
|
||||
});
|
||||
let node = src.map(|e| e.to_node(&root).syntax().clone());
|
||||
let original_range = node.as_ref().original_file_range(db);
|
||||
let path = vfs.file_path(original_range.file_id);
|
||||
let line_index = db.line_index(original_range.file_id);
|
||||
|
@ -888,12 +886,7 @@ fn pat_syntax_range(
|
|||
let src = sm.pat_syntax(pat_id);
|
||||
if let Ok(src) = src {
|
||||
let root = db.parse_or_expand(src.file_id);
|
||||
let node = src.map(|e| {
|
||||
e.either(
|
||||
|it| it.to_node(&root).syntax().clone(),
|
||||
|it| it.to_node(&root).syntax().clone(),
|
||||
)
|
||||
});
|
||||
let node = src.map(|e| e.to_node(&root).syntax().clone());
|
||||
let original_range = node.as_ref().original_file_range(db);
|
||||
let path = vfs.file_path(original_range.file_id);
|
||||
let line_index = db.line_index(original_range.file_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue