mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
remove unnecessary lazy evaluations
This commit is contained in:
parent
7530d76f00
commit
cc80c5bd07
31 changed files with 50 additions and 51 deletions
|
@ -608,7 +608,7 @@ impl<'a> FindUsages<'a> {
|
|||
let reference = FileReference {
|
||||
range,
|
||||
name: ast::NameLike::NameRef(name_ref.clone()),
|
||||
category: is_name_ref_in_import(name_ref).then(|| ReferenceCategory::Import),
|
||||
category: is_name_ref_in_import(name_ref).then_some(ReferenceCategory::Import),
|
||||
};
|
||||
sink(file_id, reference)
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ impl ReferenceCategory {
|
|||
fn new(def: &Definition, r: &ast::NameRef) -> Option<ReferenceCategory> {
|
||||
// Only Locals and Fields have accesses for now.
|
||||
if !matches!(def, Definition::Local(_) | Definition::Field(_)) {
|
||||
return is_name_ref_in_import(r).then(|| ReferenceCategory::Import);
|
||||
return is_name_ref_in_import(r).then_some(ReferenceCategory::Import);
|
||||
}
|
||||
|
||||
let mode = r.syntax().ancestors().find_map(|node| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue