From 47cbaeba6f21e59ee8735bfe8bcbf06300767b57 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 3 Sep 2018 21:03:37 +0300 Subject: Index deps --- crates/libanalysis/src/imp.rs | 10 +++++----- crates/libanalysis/src/lib.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/libanalysis') diff --git a/crates/libanalysis/src/imp.rs b/crates/libanalysis/src/imp.rs index c1e144025..3ea27947e 100644 --- a/crates/libanalysis/src/imp.rs +++ b/crates/libanalysis/src/imp.rs @@ -57,9 +57,9 @@ impl AnalysisHostImpl { } self.data_mut().crate_graph = graph; } - pub fn set_libraries(&mut self, libs: impl Iterator>) { - let libs = libs.map(ReadonlySourceRoot::new).collect::>(); - self.data_mut().libs = Arc::new(libs); + pub fn add_library(&mut self, files: impl Iterator) { + let libs = ReadonlySourceRoot::new(files); + self.data_mut().libs.push(Arc::new(libs)); } fn data_mut(&mut self) -> &mut WorldData { Arc::make_mut(&mut self.data) @@ -93,7 +93,7 @@ impl AnalysisImpl { if self.data.root.contains(file_id) { return &self.data.root; } - self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() + &**self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() } pub fn file_syntax(&self, file_id: FileId) -> &File { self.root(file_id).syntax(file_id) @@ -308,7 +308,7 @@ impl AnalysisImpl { struct WorldData { crate_graph: CrateGraph, root: WritableSourceRoot, - libs: Arc>, + libs: Vec>, } impl SourceChange { diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs index 9ae87d46c..e9e0c51d5 100644 --- a/crates/libanalysis/src/lib.rs +++ b/crates/libanalysis/src/lib.rs @@ -68,8 +68,8 @@ impl AnalysisHost { pub fn set_crate_graph(&mut self, graph: CrateGraph) { self.imp.set_crate_graph(graph) } - pub fn set_libraries(&mut self, libs: impl Iterator>) { - self.imp.set_libraries(libs) + pub fn add_library(&mut self, files: impl Iterator) { + self.imp.add_library(files) } } -- cgit v1.2.3