diff options
author | Edwin Cheng <[email protected]> | 2020-02-09 12:41:29 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-02-09 12:41:29 +0000 |
commit | 3038470c68e21e0d2aac079523955295ee54cb1a (patch) | |
tree | ef1ed79fe1347815707f18448ec86653626deed7 /crates/ra_ide/src | |
parent | dd0421e587bf312bd79eb98c821e0be437f6b361 (diff) |
Use get_or_insert_with
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/references.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index bc241fb5a..de924fad2 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -211,10 +211,9 @@ fn process_definition( | |||
211 | TokenAtOffset::Between(_, t) => t, | 211 | TokenAtOffset::Between(_, t) => t, |
212 | }; | 212 | }; |
213 | let range = t.text_range(); | 213 | let range = t.text_range(); |
214 | let analyzer = analyzer.get_or_insert( | 214 | let analyzer = analyzer.get_or_insert_with(|| { |
215 | sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None), | 215 | sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None) |
216 | ); | 216 | }); |
217 | |||
218 | let expanded = descend_into_macros_with_analyzer( | 217 | let expanded = descend_into_macros_with_analyzer( |
219 | db, | 218 | db, |
220 | &analyzer, | 219 | &analyzer, |