diff options
author | Aleksey Kladov <[email protected]> | 2018-10-15 20:05:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-15 20:05:21 +0100 |
commit | 76c51fae77d5dc2d7791132ecc78e444118e48de (patch) | |
tree | 1254d9c85ef4ff811d8a5c687face9d130cdf31d /crates/ra_analysis/src/imp.rs | |
parent | 8c88900fa9ecc71fdd58254d3f29b66912a56bd4 (diff) |
Tweak writable root API
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index fb711491b..0cf6db40d 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -94,12 +94,12 @@ impl AnalysisHostImpl { | |||
94 | } | 94 | } |
95 | } | 95 | } |
96 | pub fn change_files(&mut self, changes: &mut dyn Iterator<Item=(FileId, Option<String>)>) { | 96 | pub fn change_files(&mut self, changes: &mut dyn Iterator<Item=(FileId, Option<String>)>) { |
97 | let data = self.data_mut(); | 97 | self.data_mut() |
98 | data.root = Arc::new(data.root.apply_changes(changes, None)); | 98 | .root.apply_changes(changes, None); |
99 | } | 99 | } |
100 | pub fn set_file_resolver(&mut self, resolver: FileResolverImp) { | 100 | pub fn set_file_resolver(&mut self, resolver: FileResolverImp) { |
101 | let data = self.data_mut(); | 101 | self.data_mut() |
102 | data.root = Arc::new(data.root.apply_changes(&mut iter::empty(), Some(resolver))); | 102 | .root.apply_changes(&mut iter::empty(), Some(resolver)); |
103 | } | 103 | } |
104 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { | 104 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { |
105 | let mut visited = FxHashSet::default(); | 105 | let mut visited = FxHashSet::default(); |
@@ -141,7 +141,7 @@ impl Clone for AnalysisImpl { | |||
141 | impl AnalysisImpl { | 141 | impl AnalysisImpl { |
142 | fn root(&self, file_id: FileId) -> &SourceRoot { | 142 | fn root(&self, file_id: FileId) -> &SourceRoot { |
143 | if self.data.root.contains(file_id) { | 143 | if self.data.root.contains(file_id) { |
144 | return &*self.data.root; | 144 | return &self.data.root; |
145 | } | 145 | } |
146 | &**self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() | 146 | &**self.data.libs.iter().find(|it| it.contains(file_id)).unwrap() |
147 | } | 147 | } |
@@ -405,7 +405,7 @@ impl AnalysisImpl { | |||
405 | #[derive(Default, Clone, Debug)] | 405 | #[derive(Default, Clone, Debug)] |
406 | struct WorldData { | 406 | struct WorldData { |
407 | crate_graph: CrateGraph, | 407 | crate_graph: CrateGraph, |
408 | root: Arc<WritableSourceRoot>, | 408 | root: WritableSourceRoot, |
409 | libs: Vec<Arc<ReadonlySourceRoot>>, | 409 | libs: Vec<Arc<ReadonlySourceRoot>>, |
410 | } | 410 | } |
411 | 411 | ||