Auto merge of #16461 - Veykril:expansion-info, r=Veykril

internal: Remove unnecessary usages of ExpansionInfo

And some follow up simplifications to https://github.com/rust-lang/rust-analyzer/pull/16439
This commit is contained in:
bors 2024-01-31 08:58:55 +00:00
commit 2661c272c9
7 changed files with 175 additions and 106 deletions

View file

@ -304,14 +304,18 @@ impl Definition {
DefWithBody::InTypeConst(_) => return SearchScope::empty(),
};
return match def {
Some(def) => SearchScope::file_range(def.as_ref().original_file_range_full(db)),
Some(def) => SearchScope::file_range(
def.as_ref().original_file_range_with_macro_call_body(db),
),
None => SearchScope::single_file(file_id),
};
}
if let Definition::SelfType(impl_) = self {
return match impl_.source(db).map(|src| src.syntax().cloned()) {
Some(def) => SearchScope::file_range(def.as_ref().original_file_range_full(db)),
Some(def) => SearchScope::file_range(
def.as_ref().original_file_range_with_macro_call_body(db),
),
None => SearchScope::single_file(file_id),
};
}
@ -328,7 +332,9 @@ impl Definition {
hir::GenericDef::Const(it) => it.source(db).map(|src| src.syntax().cloned()),
};
return match def {
Some(def) => SearchScope::file_range(def.as_ref().original_file_range_full(db)),
Some(def) => SearchScope::file_range(
def.as_ref().original_file_range_with_macro_call_body(db),
),
None => SearchScope::single_file(file_id),
};
}