diff options
author | Aleksey Kladov <[email protected]> | 2019-01-15 15:19:09 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-15 15:19:09 +0000 |
commit | fb012e5c1e49af73b480127bcf56d8f5993b8032 (patch) | |
tree | 6a71bcb433b82e4c473238d439aad2ef76144157 /crates/ra_ide_api/src/symbol_index.rs | |
parent | 11f3c8afb23d67acde8cc7642aea3a2ca06a2361 (diff) |
remove cancelable from symbols
Diffstat (limited to 'crates/ra_ide_api/src/symbol_index.rs')
-rw-r--r-- | crates/ra_ide_api/src/symbol_index.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index e7827fdc9..74165d68f 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs | |||
@@ -37,13 +37,13 @@ use salsa::ParallelDatabase; | |||
37 | use rayon::prelude::*; | 37 | use rayon::prelude::*; |
38 | 38 | ||
39 | use crate::{ | 39 | use crate::{ |
40 | Cancelable, FileId, Query, | 40 | FileId, Query, |
41 | db::RootDatabase, | 41 | db::RootDatabase, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | salsa::query_group! { | 44 | salsa::query_group! { |
45 | pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { | 45 | pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { |
46 | fn file_symbols(file_id: FileId) -> Cancelable<Arc<SymbolIndex>> { | 46 | fn file_symbols(file_id: FileId) -> Arc<SymbolIndex> { |
47 | type FileSymbolsQuery; | 47 | type FileSymbolsQuery; |
48 | } | 48 | } |
49 | fn library_symbols(id: SourceRootId) -> Arc<SymbolIndex> { | 49 | fn library_symbols(id: SourceRootId) -> Arc<SymbolIndex> { |
@@ -53,7 +53,7 @@ salsa::query_group! { | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Cancelable<Arc<SymbolIndex>> { | 56 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { |
57 | db.check_canceled(); | 57 | db.check_canceled(); |
58 | let source_file = db.source_file(file_id); | 58 | let source_file = db.source_file(file_id); |
59 | let mut symbols = source_file | 59 | let mut symbols = source_file |
@@ -69,10 +69,10 @@ fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Cancelable<Arc<Sy | |||
69 | symbols.push(FileSymbol { file_id, name, ptr }) | 69 | symbols.push(FileSymbol { file_id, name, ptr }) |
70 | } | 70 | } |
71 | 71 | ||
72 | Ok(Arc::new(SymbolIndex::new(symbols))) | 72 | Arc::new(SymbolIndex::new(symbols)) |
73 | } | 73 | } |
74 | 74 | ||
75 | pub(crate) fn world_symbols(db: &RootDatabase, query: Query) -> Cancelable<Vec<FileSymbol>> { | 75 | pub(crate) fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> { |
76 | /// Need to wrap Snapshot to provide `Clone` impl for `map_with` | 76 | /// Need to wrap Snapshot to provide `Clone` impl for `map_with` |
77 | struct Snap(salsa::Snapshot<RootDatabase>); | 77 | struct Snap(salsa::Snapshot<RootDatabase>); |
78 | impl Clone for Snap { | 78 | impl Clone for Snap { |
@@ -98,10 +98,9 @@ pub(crate) fn world_symbols(db: &RootDatabase, query: Query) -> Cancelable<Vec<F | |||
98 | files | 98 | files |
99 | .par_iter() | 99 | .par_iter() |
100 | .map_with(snap, |db, &file_id| db.0.file_symbols(file_id)) | 100 | .map_with(snap, |db, &file_id| db.0.file_symbols(file_id)) |
101 | .filter_map(|it| it.ok()) | ||
102 | .collect() | 101 | .collect() |
103 | }; | 102 | }; |
104 | Ok(query.search(&buf)) | 103 | query.search(&buf) |
105 | } | 104 | } |
106 | 105 | ||
107 | #[derive(Default, Debug)] | 106 | #[derive(Default, Debug)] |