mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Simplify include handling
This commit is contained in:
parent
0003e568ca
commit
c11737cd63
6 changed files with 46 additions and 43 deletions
|
@ -208,12 +208,7 @@ impl HirFileIdExt for HirFileId {
|
|||
match file_id.repr() {
|
||||
HirFileIdRepr::FileId(id) => break id,
|
||||
HirFileIdRepr::MacroFile(MacroFileId { macro_call_id }) => {
|
||||
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_call_id);
|
||||
let is_include_expansion = loc.def.is_include() && loc.eager.is_some();
|
||||
file_id = match is_include_expansion.then(|| db.include_expand(macro_call_id)) {
|
||||
Some(Ok((_, file))) => file.into(),
|
||||
_ => loc.kind.file_id(),
|
||||
}
|
||||
file_id = db.lookup_intern_macro_call(macro_call_id).kind.file_id();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue