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

@ -234,6 +234,8 @@ fn _format(
file_id: FileId,
expansion: &str,
) -> Option<String> {
use ide_db::base_db::RootQueryDb;
// hack until we get hygiene working (same character amount to preserve formatting as much as possible)
const DOLLAR_CRATE_REPLACE: &str = "__r_a_";
const BUILTIN_REPLACE: &str = "builtin__POUND";
@ -247,9 +249,8 @@ fn _format(
};
let expansion = format!("{prefix}{expansion}{suffix}");
let upcast_db = ide_db::base_db::Upcast::<dyn ide_db::base_db::RootQueryDb>::upcast(db);
let &crate_id = upcast_db.relevant_crates(file_id).iter().next()?;
let edition = crate_id.data(upcast_db).edition;
let &crate_id = db.relevant_crates(file_id).iter().next()?;
let edition = crate_id.data(db).edition;
#[allow(clippy::disallowed_methods)]
let mut cmd = std::process::Command::new(toolchain::Tool::Rustfmt.path());