From 5766ceab0629acc4464dcc57d00d9cc5c12f1c6b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 15 Nov 2019 13:16:16 +0300 Subject: Add convenience method for testing --- crates/ra_hir_def/src/nameres/tests/incremental.rs | 6 +++--- crates/ra_hir_def/src/nameres/tests/mod_resolution.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def/src/nameres/tests') diff --git a/crates/ra_hir_def/src/nameres/tests/incremental.rs b/crates/ra_hir_def/src/nameres/tests/incremental.rs index 80dcec62f..903a22771 100644 --- a/crates/ra_hir_def/src/nameres/tests/incremental.rs +++ b/crates/ra_hir_def/src/nameres/tests/incremental.rs @@ -1,12 +1,12 @@ use std::sync::Arc; -use ra_db::{SourceDatabase, SourceDatabaseExt}; +use ra_db::SourceDatabaseExt; use super::*; fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) { let (mut db, pos) = TestDB::with_position(initial); - let krate = db.crate_graph().iter().next().unwrap(); + let krate = db.test_crate(); { let events = db.log_executed(|| { db.crate_def_map(krate); @@ -111,7 +111,7 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() { m!(X); ", ); - let krate = db.crate_graph().iter().next().unwrap(); + let krate = db.test_crate(); { let events = db.log_executed(|| { let crate_def_map = db.crate_def_map(krate); diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs index dee364a14..eb7b85c07 100644 --- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs @@ -656,7 +656,7 @@ fn unresolved_module_diagnostics() { //- /foo.rs ", ); - let krate = db.crate_graph().iter().next().unwrap(); + let krate = db.test_crate(); let crate_def_map = db.crate_def_map(krate); -- cgit v1.2.3