mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Use get_or_insert_with
This commit is contained in:
parent
dd0421e587
commit
3038470c68
1 changed files with 3 additions and 4 deletions
|
@ -211,10 +211,9 @@ fn process_definition(
|
||||||
TokenAtOffset::Between(_, t) => t,
|
TokenAtOffset::Between(_, t) => t,
|
||||||
};
|
};
|
||||||
let range = t.text_range();
|
let range = t.text_range();
|
||||||
let analyzer = analyzer.get_or_insert(
|
let analyzer = analyzer.get_or_insert_with(|| {
|
||||||
sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None),
|
sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None)
|
||||||
);
|
});
|
||||||
|
|
||||||
let expanded = descend_into_macros_with_analyzer(
|
let expanded = descend_into_macros_with_analyzer(
|
||||||
db,
|
db,
|
||||||
&analyzer,
|
&analyzer,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue