Use get_or_insert_with

This commit is contained in:
Edwin Cheng 2020-02-09 20:41:29 +08:00
parent dd0421e587
commit 3038470c68

View File

@ -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,