diff options
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/roots.rs | 5 | ||||
-rw-r--r-- | crates/ra_analysis/src/symbol_index.rs | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/roots.rs b/crates/ra_analysis/src/roots.rs index 7100f7c71..15081f555 100644 --- a/crates/ra_analysis/src/roots.rs +++ b/crates/ra_analysis/src/roots.rs | |||
@@ -3,6 +3,7 @@ use std::{sync::Arc}; | |||
3 | use ra_editor::LineIndex; | 3 | use ra_editor::LineIndex; |
4 | use ra_syntax::File; | 4 | use ra_syntax::File; |
5 | use rustc_hash::FxHashSet; | 5 | use rustc_hash::FxHashSet; |
6 | use rayon::prelude::*; | ||
6 | use salsa::Database; | 7 | use salsa::Database; |
7 | 8 | ||
8 | use crate::{ | 9 | use crate::{ |
@@ -105,8 +106,8 @@ impl ReadonlySourceRoot { | |||
105 | .set((), Arc::new(db::FileSet { files: file_ids, resolver })); | 106 | .set((), Arc::new(db::FileSet { files: file_ids, resolver })); |
106 | let file_set = db.file_set(); | 107 | let file_set = db.file_set(); |
107 | let symbol_index = | 108 | let symbol_index = |
108 | SymbolIndex::for_files(file_set.files.iter() // TODO: par iter | 109 | SymbolIndex::for_files(file_set.files.par_iter() |
109 | .map(|&file_id| (file_id, db.file_syntax(file_id)))); | 110 | .map_with(db.clone(), |db, &file_id| (file_id, db.file_syntax(file_id)))); |
110 | 111 | ||
111 | ReadonlySourceRoot { db, symbol_index: Arc::new(symbol_index) } | 112 | ReadonlySourceRoot { db, symbol_index: Arc::new(symbol_index) } |
112 | } | 113 | } |
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index 1b7d9f779..e5c8d8870 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs | |||
@@ -34,7 +34,7 @@ impl Hash for SymbolIndex { | |||
34 | } | 34 | } |
35 | 35 | ||
36 | impl SymbolIndex { | 36 | impl SymbolIndex { |
37 | pub(crate) fn for_files(files: impl Iterator<Item = (FileId, File)>) -> SymbolIndex { | 37 | pub(crate) fn for_files(files: impl ParallelIterator<Item = (FileId, File)>) -> SymbolIndex { |
38 | let mut symbols = files | 38 | let mut symbols = files |
39 | .flat_map(|(file_id, file)| { | 39 | .flat_map(|(file_id, file)| { |
40 | file_symbols(&file) | 40 | file_symbols(&file) |
@@ -52,7 +52,7 @@ impl SymbolIndex { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | pub(crate) fn for_file(file_id: FileId, file: File) -> SymbolIndex { | 54 | pub(crate) fn for_file(file_id: FileId, file: File) -> SymbolIndex { |
55 | SymbolIndex::for_files(::std::iter::once((file_id, file))) | 55 | SymbolIndex::for_files(rayon::iter::once((file_id, file))) |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||