Add prefix file_ to Semantics's to_module_defs()/to_module_def() methods

This commit is contained in:
Vincent Esche 2024-02-28 10:13:31 +01:00
parent 0ac05c0527
commit 6112ddfabb
12 changed files with 16 additions and 16 deletions

View file

@ -48,7 +48,7 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module))
.collect(),
None => sema
.to_module_defs(position.file_id)
.file_to_module_defs(position.file_id)
.flat_map(|module| NavigationTarget::from_module_to_decl(db, module))
.collect(),
}

View file

@ -156,7 +156,7 @@ pub(crate) fn will_rename_file(
new_name_stem: &str,
) -> Option<SourceChange> {
let sema = Semantics::new(db);
let module = sema.to_module_def(file_id)?;
let module = sema.file_to_module_def(file_id)?;
let def = Definition::Module(module);
let mut change = if is_raw_identifier(new_name_stem) {
def.rename(&sema, &SmolStr::from_iter(["r#", new_name_stem])).ok()?

View file

@ -178,7 +178,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
}
});
sema.to_module_defs(file_id)
sema.file_to_module_defs(file_id)
.map(|it| runnable_mod_outline_definition(&sema, it))
.for_each(|it| add_opt(it, None));

View file

@ -223,7 +223,7 @@ fn traverse(
krate: hir::Crate,
range_to_highlight: TextRange,
) {
let is_unlinked = sema.to_module_def(file_id).is_none();
let is_unlinked = sema.file_to_module_def(file_id).is_none();
let mut bindings_shadow_count: FxHashMap<Name, u32> = FxHashMap::default();
enum AttrOrDerive {