aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/test_db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/test_db.rs')
-rw-r--r--crates/ra_assists/src/test_db.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/crates/ra_assists/src/test_db.rs b/crates/ra_assists/src/test_db.rs
deleted file mode 100644
index d5249f308..000000000
--- a/crates/ra_assists/src/test_db.rs
+++ /dev/null
@@ -1,45 +0,0 @@
1//! Database used for testing `ra_assists`.
2
3use std::sync::Arc;
4
5use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath};
6
7#[salsa::database(
8 ra_db::SourceDatabaseExtStorage,
9 ra_db::SourceDatabaseStorage,
10 hir::db::InternDatabaseStorage,
11 hir::db::AstDatabaseStorage,
12 hir::db::DefDatabaseStorage,
13 hir::db::HirDatabaseStorage
14)]
15#[derive(Debug, Default)]
16pub struct TestDB {
17 runtime: salsa::Runtime<TestDB>,
18}
19
20impl salsa::Database for TestDB {
21 fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
22 &self.runtime
23 }
24 fn salsa_runtime_mut(&mut self) -> &mut salsa::Runtime<Self> {
25 &mut self.runtime
26 }
27}
28
29impl std::panic::RefUnwindSafe for TestDB {}
30
31impl FileLoader for TestDB {
32 fn file_text(&self, file_id: FileId) -> Arc<String> {
33 FileLoaderDelegate(self).file_text(file_id)
34 }
35 fn resolve_relative_path(
36 &self,
37 anchor: FileId,
38 relative_path: &RelativePath,
39 ) -> Option<FileId> {
40 FileLoaderDelegate(self).resolve_relative_path(anchor, relative_path)
41 }
42 fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> {
43 FileLoaderDelegate(self).relevant_crates(file_id)
44 }
45}