Remove dead code

This commit is contained in:
Aleksey Kladov 2020-06-11 13:26:48 +02:00
parent 32157d48f4
commit 663ce0e99d
4 changed files with 3 additions and 29 deletions

View File

@ -16,7 +16,7 @@
use crate::{
symbol_index::{SymbolIndex, SymbolsDatabase},
DebugData, RootDatabase,
RootDatabase,
};
#[derive(Default)]
@ -26,7 +26,6 @@ pub struct AnalysisChange {
files_changed: Vec<(FileId, Arc<String>)>,
libraries_added: Vec<LibraryData>,
crate_graph: Option<CrateGraph>,
debug_data: DebugData,
}
impl fmt::Debug for AnalysisChange {
@ -87,10 +86,6 @@ pub fn add_library(&mut self, data: LibraryData) {
pub fn set_crate_graph(&mut self, graph: CrateGraph) {
self.crate_graph = Some(graph);
}
pub fn set_debug_root_path(&mut self, source_root_id: SourceRootId, path: String) {
self.debug_data.root_paths.insert(source_root_id, path);
}
}
#[derive(Debug)]
@ -218,8 +213,6 @@ pub fn apply_change(&mut self, change: AnalysisChange) {
if let Some(crate_graph) = change.crate_graph {
self.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH)
}
Arc::make_mut(&mut self.debug_data).merge(change.debug_data)
}
fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) {

View File

@ -17,9 +17,9 @@
use ra_db::{
salsa::{self, Database, Durability},
Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase,
SourceRootId, Upcast,
Upcast,
};
use rustc_hash::{FxHashMap, FxHashSet};
use rustc_hash::FxHashSet;
use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase};
@ -36,7 +36,6 @@
#[derive(Debug)]
pub struct RootDatabase {
runtime: salsa::Runtime<RootDatabase>,
pub(crate) debug_data: Arc<DebugData>,
pub last_gc: crate::wasm_shims::Instant,
pub last_gc_check: crate::wasm_shims::Instant,
}
@ -98,7 +97,6 @@ pub fn new(lru_capacity: Option<usize>) -> RootDatabase {
runtime: salsa::Runtime::default(),
last_gc: crate::wasm_shims::Instant::now(),
last_gc_check: crate::wasm_shims::Instant::now(),
debug_data: Default::default(),
};
db.set_crate_graph_with_durability(Default::default(), Durability::HIGH);
db.set_local_roots_with_durability(Default::default(), Durability::HIGH);
@ -121,7 +119,6 @@ fn snapshot(&self) -> salsa::Snapshot<RootDatabase> {
runtime: self.runtime.snapshot(self),
last_gc: self.last_gc,
last_gc_check: self.last_gc_check,
debug_data: Arc::clone(&self.debug_data),
})
}
}
@ -135,14 +132,3 @@ fn line_index(db: &impl LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
let text = db.file_text(file_id);
Arc::new(LineIndex::new(&*text))
}
#[derive(Debug, Default, Clone)]
pub(crate) struct DebugData {
pub(crate) root_paths: FxHashMap<SourceRootId, String>,
}
impl DebugData {
pub(crate) fn merge(&mut self, other: DebugData) {
self.root_paths.extend(other.root_paths.into_iter());
}
}

View File

@ -111,10 +111,6 @@ pub(crate) fn load(
vfs.root2path(root)
);
analysis_change.add_root(source_root_id, is_local);
analysis_change.set_debug_root_path(
source_root_id,
source_roots[&source_root_id].path().display().to_string(),
);
let vfs_root_path = vfs.root2path(root);
if extern_dirs.contains(&vfs_root_path) {

View File

@ -126,7 +126,6 @@ pub fn new(
let vfs_root_path = vfs.root2path(r);
let is_local = local_roots.iter().any(|it| vfs_root_path.starts_with(it));
change.add_root(SourceRootId(r.0), is_local);
change.set_debug_root_path(SourceRootId(r.0), vfs_root_path.display().to_string());
// FIXME: add path2root in vfs to simpily this logic
if extern_dirs.contains(&vfs_root_path) {