From 3038470c68e21e0d2aac079523955295ee54cb1a Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 9 Feb 2020 20:41:29 +0800 Subject: Use get_or_insert_with --- crates/ra_ide/src/references.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide/src') 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( TokenAtOffset::Between(_, t) => t, }; let range = t.text_range(); - let analyzer = analyzer.get_or_insert( - sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None), - ); - + let analyzer = analyzer.get_or_insert_with(|| { + sb.analyze(InFile::new(file_id.into(), parse.tree().syntax()), None) + }); let expanded = descend_into_macros_with_analyzer( db, &analyzer, -- cgit v1.2.3