Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests.rs')
-rw-r--r--crates/hir-ty/src/tests.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/crates/hir-ty/src/tests.rs b/crates/hir-ty/src/tests.rs
index c8cc61cc21..671fd9ec3a 100644
--- a/crates/hir-ty/src/tests.rs
+++ b/crates/hir-ty/src/tests.rs
@@ -16,7 +16,7 @@ use base_db::{FileRange, SourceDatabaseExt};
use expect_test::Expect;
use hir_def::{
body::{Body, BodySourceMap, SyntheticSyntax},
- db::{DefDatabase, InternDatabase},
+ db::DefDatabase,
hir::{ExprId, Pat, PatId},
item_scope::ItemScope,
nameres::DefMap,
@@ -145,7 +145,7 @@ fn check_impl(ra_fixture: &str, allow_none: bool, only_types: bool, display_sour
loc.source(&db).value.syntax().text_range().start()
}
DefWithBodyId::VariantId(it) => {
- let loc = db.lookup_intern_enum(it.parent);
+ let loc = it.lookup(&db);
loc.source(&db).value.syntax().text_range().start()
}
DefWithBodyId::InTypeConstId(it) => it.source(&db).syntax().text_range().start(),
@@ -383,7 +383,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
loc.source(&db).value.syntax().text_range().start()
}
DefWithBodyId::VariantId(it) => {
- let loc = db.lookup_intern_enum(it.parent);
+ let loc = it.lookup(&db);
loc.source(&db).value.syntax().text_range().start()
}
DefWithBodyId::InTypeConstId(it) => it.source(&db).syntax().text_range().start(),
@@ -453,16 +453,12 @@ fn visit_module(
visit_body(db, &body, cb);
}
ModuleDefId::AdtId(hir_def::AdtId::EnumId(it)) => {
- db.enum_data(it)
- .variants
- .iter()
- .map(|(id, _)| hir_def::EnumVariantId { parent: it, local_id: id })
- .for_each(|it| {
- let def = it.into();
- cb(def);
- let body = db.body(def);
- visit_body(db, &body, cb);
- });
+ db.enum_data(it).variants.iter().for_each(|&(it, _)| {
+ let def = it.into();
+ cb(def);
+ let body = db.body(def);
+ visit_body(db, &body, cb);
+ });
}
ModuleDefId::TraitId(it) => {
let trait_data = db.trait_data(it);