Re-implement InFile wrappers as type aliases over generic InFileWrapper

This commit is contained in:
Lukas Wirth 2023-11-25 14:39:55 +01:00
parent 30093a6d81
commit c43078f99d
13 changed files with 151 additions and 107 deletions

View file

@ -7,7 +7,7 @@ use hir_def::{
AdtId, AssocItemId, DefWithBodyId, HasModule, ImplId, Lookup, MacroId, ModuleDefId, ModuleId,
TraitId,
};
use hir_expand::{files::ascend_range_up_macros, HirFileId, InFile};
use hir_expand::{HirFileId, InFile};
use hir_ty::db::HirDatabase;
use syntax::{ast::HasName, AstNode, SmolStr, SyntaxNode, SyntaxNodePtr};
@ -51,8 +51,7 @@ impl DeclarationLocation {
}
pub fn original_name_range(&self, db: &dyn HirDatabase) -> FileRange {
let mapping = InFile::new(self.hir_file_id, self.name_ptr.text_range());
ascend_range_up_macros(db.upcast(), mapping).0
InFile::new(self.hir_file_id, self.name_ptr.text_range()).original_file_range(db.upcast())
}
}