diff options
-rw-r--r-- | crates/libanalysis/src/symbol_index.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/libanalysis/src/symbol_index.rs b/crates/libanalysis/src/symbol_index.rs index 8fef326ab..4c93761aa 100644 --- a/crates/libanalysis/src/symbol_index.rs +++ b/crates/libanalysis/src/symbol_index.rs | |||
@@ -42,7 +42,7 @@ impl SymbolIndex { | |||
42 | 42 | ||
43 | impl Query { | 43 | impl Query { |
44 | pub(crate) fn search( | 44 | pub(crate) fn search( |
45 | mut self, | 45 | self, |
46 | indices: &[&SymbolIndex], | 46 | indices: &[&SymbolIndex], |
47 | token: &JobToken, | 47 | token: &JobToken, |
48 | ) -> Vec<(FileId, FileSymbol)> { | 48 | ) -> Vec<(FileId, FileSymbol)> { |
@@ -55,7 +55,7 @@ impl Query { | |||
55 | let mut stream = op.union(); | 55 | let mut stream = op.union(); |
56 | let mut res = Vec::new(); | 56 | let mut res = Vec::new(); |
57 | while let Some((_, indexed_values)) = stream.next() { | 57 | while let Some((_, indexed_values)) = stream.next() { |
58 | if self.limit == 0 || token.is_canceled() { | 58 | if res.len() >= self.limit || token.is_canceled() { |
59 | break; | 59 | break; |
60 | } | 60 | } |
61 | for indexed_value in indexed_values { | 61 | for indexed_value in indexed_values { |
@@ -70,7 +70,6 @@ impl Query { | |||
70 | continue; | 70 | continue; |
71 | } | 71 | } |
72 | res.push((*file_id, symbol.clone())); | 72 | res.push((*file_id, symbol.clone())); |
73 | self.limit -= 1; | ||
74 | } | 73 | } |
75 | } | 74 | } |
76 | res | 75 | res |