aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src/imp.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-30 14:27:09 +0100
committerAleksey Kladov <[email protected]>2018-08-30 14:27:09 +0100
commit9fcebbc51284408203c05219a0ee92519f51ea74 (patch)
tree5fd3f53769e3fe5b8f6a0d2a5eaa86167b7a3b10 /crates/libanalysis/src/imp.rs
parent7570d85869da7e2d35958047f8d1a90e3b6e2212 (diff)
subscriptions
Diffstat (limited to 'crates/libanalysis/src/imp.rs')
-rw-r--r--crates/libanalysis/src/imp.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/libanalysis/src/imp.rs b/crates/libanalysis/src/imp.rs
index 004942e72..97802bd50 100644
--- a/crates/libanalysis/src/imp.rs
+++ b/crates/libanalysis/src/imp.rs
@@ -39,11 +39,11 @@ impl AnalysisHostImpl {
39 39
40 pub fn analysis( 40 pub fn analysis(
41 &self, 41 &self,
42 file_resolver: impl FileResolver, 42 file_resolver: Arc<dyn FileResolver>,
43 ) -> AnalysisImpl { 43 ) -> AnalysisImpl {
44 AnalysisImpl { 44 AnalysisImpl {
45 needs_reindex: AtomicBool::new(false), 45 needs_reindex: AtomicBool::new(false),
46 file_resolver: Arc::new(file_resolver), 46 file_resolver,
47 data: self.data.clone(), 47 data: self.data.clone(),
48 } 48 }
49 } 49 }
@@ -78,7 +78,7 @@ impl AnalysisHostImpl {
78 78
79pub(crate) struct AnalysisImpl { 79pub(crate) struct AnalysisImpl {
80 needs_reindex: AtomicBool, 80 needs_reindex: AtomicBool,
81 file_resolver: Arc<FileResolver>, 81 file_resolver: Arc<dyn FileResolver>,
82 data: Arc<WorldData>, 82 data: Arc<WorldData>,
83} 83}
84 84
@@ -236,15 +236,13 @@ impl AnalysisImpl {
236 ("add `#[derive]`", libeditor::add_derive(&file, offset).map(|f| f())), 236 ("add `#[derive]`", libeditor::add_derive(&file, offset).map(|f| f())),
237 ("add impl", libeditor::add_impl(&file, offset).map(|f| f())), 237 ("add impl", libeditor::add_impl(&file, offset).map(|f| f())),
238 ]; 238 ];
239 let mut res = Vec::new(); 239 actions.into_iter()
240 for (name, local_edit) in actions { 240 .filter_map(|(name, local_edit)| {
241 if let Some(local_edit) = local_edit { 241 Some(SourceChange::from_local_edit(
242 res.push(SourceChange::from_local_edit( 242 file_id, name, local_edit?,
243 file_id, name, local_edit
244 )) 243 ))
245 } 244 })
246 } 245 .collect()
247 res
248 } 246 }
249 247
250 fn index_resolve(&self, name_ref: ast::NameRef) -> Vec<(FileId, FileSymbol)> { 248 fn index_resolve(&self, name_ref: ast::NameRef) -> Vec<(FileId, FileSymbol)> {