Remove all upcasts!

It turns out there were a lot redundant too.
This commit is contained in:
Chayim Refael Friedman 2025-04-10 11:08:38 +03:00
parent a775d21112
commit 8a9a1e3345
80 changed files with 1009 additions and 1257 deletions

View file

@ -1,6 +1,6 @@
//! This module resolves `mod foo;` declaration to file.
use arrayvec::ArrayVec;
use base_db::{AnchoredPath, RootQueryDb};
use base_db::AnchoredPath;
use hir_expand::{HirFileIdExt, name::Name};
use span::EditionedFileId;
@ -77,11 +77,10 @@ impl ModDir {
}
};
let orig_file_id = file_id.original_file_respecting_includes(db.upcast());
let orig_file_id = file_id.original_file_respecting_includes(db);
for candidate in candidate_files.iter() {
let path = AnchoredPath { anchor: orig_file_id.file_id(), path: candidate.as_str() };
if let Some(file_id) = base_db::Upcast::<dyn RootQueryDb>::upcast(db).resolve_path(path)
{
if let Some(file_id) = db.resolve_path(path) {
let is_mod_rs = candidate.ends_with("/mod.rs");
let root_dir_owner = is_mod_rs || attr_path.is_some();