From 61f3a438d3a729a6be941bca1ff4c6a97a33f221 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Mon, 15 Oct 2018 17:44:23 -0400 Subject: Cargo Format Run `cargo fmt` and ignore generated files --- crates/ra_analysis/src/symbol_index.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'crates/ra_analysis/src/symbol_index.rs') diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index 54672fde4..51eef8170 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs @@ -1,15 +1,16 @@ -use std::{ - sync::Arc, - hash::{Hash, Hasher}, -}; -use ra_editor::{FileSymbol, file_symbols}; +use crate::{FileId, JobToken, Query}; +use fst::{self, Streamer}; +use ra_editor::{file_symbols, FileSymbol}; use ra_syntax::{ File, SyntaxKind::{self, *}, }; -use fst::{self, Streamer}; use rayon::prelude::*; -use crate::{Query, FileId, JobToken}; + +use std::{ + hash::{Hash, Hasher}, + sync::Arc, +}; #[derive(Debug)] pub(crate) struct SymbolIndex { @@ -23,8 +24,7 @@ impl PartialEq for SymbolIndex { } } -impl Eq for SymbolIndex { -} +impl Eq for SymbolIndex {} impl Hash for SymbolIndex { fn hash(&self, hasher: &mut H) { @@ -33,14 +33,12 @@ impl Hash for SymbolIndex { } impl SymbolIndex { - pub(crate) fn for_files(files: impl ParallelIterator) -> SymbolIndex { + pub(crate) fn for_files(files: impl ParallelIterator) -> SymbolIndex { let mut symbols = files .flat_map(|(file_id, file)| { file_symbols(&file) .into_iter() - .map(move |symbol| { - (symbol.name.as_str().to_lowercase(), (file_id, symbol)) - }) + .map(move |symbol| (symbol.name.as_str().to_lowercase(), (file_id, symbol))) .collect::>() }) .collect::>(); @@ -48,9 +46,7 @@ impl SymbolIndex { symbols.dedup_by(|s1, s2| s1.0 == s2.0); let (names, symbols): (Vec, Vec<(FileId, FileSymbol)>) = symbols.into_iter().unzip(); - let map = fst::Map::from_iter( - names.into_iter().zip(0u64..) - ).unwrap(); + let map = fst::Map::from_iter(names.into_iter().zip(0u64..)).unwrap(); SymbolIndex { symbols, map } } @@ -65,7 +61,6 @@ impl Query { indices: &[Arc], token: &JobToken, ) -> Vec<(FileId, FileSymbol)> { - let mut op = fst::map::OpBuilder::new(); for file_symbols in indices.iter() { let automaton = fst::automaton::Subsequence::new(&self.lowercased); -- cgit v1.2.3