diff --git a/Cargo.lock b/Cargo.lock index 38d1d0cd6a..cb57a82216 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -606,7 +606,6 @@ dependencies = [ "profile", "pulldown-cmark", "pulldown-cmark-to-cmark", - "rustc-hash", "stdx", "syntax", "test_utils", @@ -627,7 +626,6 @@ dependencies = [ "ide_db", "itertools", "profile", - "rustc-hash", "sourcegen", "stdx", "syntax", @@ -647,7 +645,6 @@ dependencies = [ "itertools", "once_cell", "profile", - "rustc-hash", "smallvec", "stdx", "syntax", @@ -695,7 +692,6 @@ dependencies = [ "ide_db", "itertools", "profile", - "rustc-hash", "sourcegen", "stdx", "syntax", @@ -713,7 +709,6 @@ dependencies = [ "ide_db", "itertools", "parser", - "rustc-hash", "syntax", "test_utils", "text_edit", diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index d09b4a0daf..f8bb1e4c01 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml @@ -15,7 +15,6 @@ crossbeam-channel = "0.5.4" either = "1.6.1" itertools = "0.10.3" tracing = "0.1.32" -rustc-hash = "1.1.0" oorandom = "11.1.3" pulldown-cmark-to-cmark = "10.0.1" pulldown-cmark = { version = "0.9.1", default-features = false } diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs index ba999524d6..e69e959d32 100755 --- a/crates/ide/src/folding_ranges.rs +++ b/crates/ide/src/folding_ranges.rs @@ -1,6 +1,4 @@ -use ide_db::syntax_helpers::node_ext::vis_eq; -use rustc_hash::FxHashSet; - +use ide_db::{syntax_helpers::node_ext::vis_eq, FxHashSet}; use syntax::{ ast::{self, AstNode, AstToken}, match_ast, Direction, NodeOrToken, SourceFile, diff --git a/crates/ide/src/highlight_related.rs b/crates/ide/src/highlight_related.rs index 84fdbc60f8..2aa4fbf55e 100644 --- a/crates/ide/src/highlight_related.rs +++ b/crates/ide/src/highlight_related.rs @@ -5,9 +5,8 @@ use ide_db::{ helpers::pick_best_token, search::{FileReference, ReferenceCategory, SearchScope}, syntax_helpers::node_ext::{for_each_break_and_continue_expr, for_each_tail_expr, walk_expr}, - RootDatabase, + FxHashSet, RootDatabase, }; -use rustc_hash::FxHashSet; use syntax::{ ast::{self, HasLoopBody}, match_ast, AstNode, diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index ba2b397f2a..f78e70f7a3 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -1,10 +1,10 @@ use either::Either; use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo}; use ide_db::{ - base_db::FileRange, famous_defs::FamousDefs, syntax_helpers::node_ext::walk_ty, RootDatabase, + base_db::FileRange, famous_defs::FamousDefs, syntax_helpers::node_ext::walk_ty, FxHashMap, + RootDatabase, }; use itertools::Itertools; -use rustc_hash::FxHashMap; use stdx::to_lower_snake_case; use syntax::{ ast::{self, AstNode, HasArgList, HasGenericParams, HasName, UnaryOp}, diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs index 892b34c7d9..2962700360 100644 --- a/crates/ide/src/prime_caches.rs +++ b/crates/ide/src/prime_caches.rs @@ -12,9 +12,8 @@ use ide_db::{ salsa::{Database, ParallelDatabase, Snapshot}, Cancelled, CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt, }, - FxIndexMap, + FxHashSet, FxIndexMap, }; -use rustc_hash::FxHashSet; use crate::RootDatabase; diff --git a/crates/ide/src/prime_caches/topologic_sort.rs b/crates/ide/src/prime_caches/topologic_sort.rs index b04087fa7b..9c3ceedbb6 100644 --- a/crates/ide/src/prime_caches/topologic_sort.rs +++ b/crates/ide/src/prime_caches/topologic_sort.rs @@ -1,7 +1,7 @@ //! helper data structure to schedule work for parallel prime caches. use std::{collections::VecDeque, hash::Hash}; -use rustc_hash::FxHashMap; +use ide_db::FxHashMap; pub(crate) struct TopologicSortIterBuilder { nodes: FxHashMap>, diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index fe9c5bd785..0cd29c8432 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -14,9 +14,8 @@ use ide_db::{ base_db::FileId, defs::{Definition, NameClass, NameRefClass}, search::{ReferenceCategory, SearchScope, UsageSearchResult}, - RootDatabase, + FxHashMap, RootDatabase, }; -use rustc_hash::FxHashMap; use syntax::{ algo::find_node_at_offset, ast::{self, HasName}, diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 88e17fadac..2c21bbc165 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -9,10 +9,9 @@ use ide_db::{ defs::Definition, helpers::visit_file_defs, search::SearchScope, - RootDatabase, SymbolKind, + FxHashMap, FxHashSet, RootDatabase, SymbolKind, }; use itertools::Itertools; -use rustc_hash::{FxHashMap, FxHashSet}; use stdx::{always, format_to}; use syntax::{ ast::{self, AstNode, HasAttrs as _}, diff --git a/crates/ide/src/shuffle_crate_graph.rs b/crates/ide/src/shuffle_crate_graph.rs index a7720d8156..15cb89dcce 100644 --- a/crates/ide/src/shuffle_crate_graph.rs +++ b/crates/ide/src/shuffle_crate_graph.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use ide_db::base_db::salsa::Durability; -use ide_db::base_db::{CrateGraph, SourceDatabase}; -use ide_db::RootDatabase; -use rustc_hash::FxHashMap; +use ide_db::{ + base_db::{salsa::Durability, CrateGraph, SourceDatabase}, + FxHashMap, RootDatabase, +}; // Feature: Shuffle Crate Graph // diff --git a/crates/ide/src/ssr.rs b/crates/ide/src/ssr.rs index ba9a7f62e6..497eb1cc13 100644 --- a/crates/ide/src/ssr.rs +++ b/crates/ide/src/ssr.rs @@ -63,9 +63,8 @@ mod tests { use ide_db::{ base_db::{fixture::WithFixture, salsa::Durability, FileRange}, symbol_index::SymbolsDatabase, - RootDatabase, + FxHashSet, RootDatabase, }; - use rustc_hash::FxHashSet; use super::ssr_assists; diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs index 0980b87155..7bc39c8d1c 100644 --- a/crates/ide/src/static_index.rs +++ b/crates/ide/src/static_index.rs @@ -7,9 +7,8 @@ use hir::{db::HirDatabase, Crate, Module, Semantics}; use ide_db::{ base_db::{FileId, FileRange, SourceDatabaseExt}, defs::{Definition, IdentClass}, - RootDatabase, + FxHashSet, RootDatabase, }; -use rustc_hash::FxHashSet; use syntax::{AstNode, SyntaxKind::*, SyntaxToken, TextRange, T}; use crate::{ diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 908bbfde24..f6754e44f3 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -14,8 +14,7 @@ mod html; mod tests; use hir::{InFile, Name, Semantics}; -use ide_db::RootDatabase; -use rustc_hash::FxHashMap; +use ide_db::{FxHashMap, RootDatabase}; use syntax::{ ast, AstNode, AstToken, NodeOrToken, SyntaxKind::*, SyntaxNode, TextRange, WalkEvent, T, }; diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 3fd0748172..e04fd5a7c7 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -3,9 +3,8 @@ use hir::{AsAssocItem, HasVisibility, Semantics}; use ide_db::{ defs::{Definition, IdentClass, NameClass, NameRefClass}, - RootDatabase, SymbolKind, + FxHashMap, RootDatabase, SymbolKind, }; -use rustc_hash::FxHashMap; use syntax::{ ast, match_ast, AstNode, AstToken, NodeOrToken, SyntaxKind::{self, *}, diff --git a/crates/ide/src/view_crate_graph.rs b/crates/ide/src/view_crate_graph.rs index 30ec67b069..51291a6453 100644 --- a/crates/ide/src/view_crate_graph.rs +++ b/crates/ide/src/view_crate_graph.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use dot::{Id, LabelText}; use ide_db::{ base_db::{CrateGraph, CrateId, Dependency, SourceDatabase, SourceDatabaseExt}, - RootDatabase, + FxHashSet, RootDatabase, }; -use rustc_hash::FxHashSet; // Feature: View Crate Graph // diff --git a/crates/ide_assists/Cargo.toml b/crates/ide_assists/Cargo.toml index 4caa9285b4..edd0d26290 100644 --- a/crates/ide_assists/Cargo.toml +++ b/crates/ide_assists/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] cov-mark = "2.0.0-pre.1" -rustc-hash = "1.1.0" + itertools = "0.10.3" either = "1.6.1" diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs index 45f98e690f..ebfd65ae79 100644 --- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs @@ -7,10 +7,9 @@ use ide_db::{ helpers::mod_path_to_ast, imports::insert_use::{insert_use, ImportScope, InsertUseConfig}, search::FileReference, - RootDatabase, + FxHashSet, RootDatabase, }; use itertools::{Itertools, Position}; -use rustc_hash::FxHashSet; use syntax::{ ast::{ self, edit::IndentLevel, edit_in_place::Indent, make, AstNode, HasAttrs, HasGenericParams, diff --git a/crates/ide_assists/src/handlers/generate_function.rs b/crates/ide_assists/src/handlers/generate_function.rs index 79f5d0499e..24cef5630f 100644 --- a/crates/ide_assists/src/handlers/generate_function.rs +++ b/crates/ide_assists/src/handlers/generate_function.rs @@ -1,11 +1,9 @@ -use rustc_hash::{FxHashMap, FxHashSet}; - use hir::{HasSource, HirDisplay, Module, Semantics, TypeInfo}; use ide_db::{ base_db::FileId, defs::{Definition, NameRefClass}, famous_defs::FamousDefs, - RootDatabase, SnippetCap, + FxHashMap, FxHashSet, RootDatabase, SnippetCap, }; use stdx::to_lower_snake_case; use syntax::{ diff --git a/crates/ide_assists/src/handlers/introduce_named_lifetime.rs b/crates/ide_assists/src/handlers/introduce_named_lifetime.rs index ec6be2e816..fa7635d123 100644 --- a/crates/ide_assists/src/handlers/introduce_named_lifetime.rs +++ b/crates/ide_assists/src/handlers/introduce_named_lifetime.rs @@ -1,4 +1,4 @@ -use rustc_hash::FxHashSet; +use ide_db::FxHashSet; use syntax::{ ast::{self, edit_in_place::GenericParamsOwnerEdit, make, HasGenericParams}, ted::{self, Position}, diff --git a/crates/ide_assists/src/handlers/reorder_fields.rs b/crates/ide_assists/src/handlers/reorder_fields.rs index cd4eb7c15e..35c4cb6d64 100644 --- a/crates/ide_assists/src/handlers/reorder_fields.rs +++ b/crates/ide_assists/src/handlers/reorder_fields.rs @@ -1,7 +1,6 @@ use either::Either; +use ide_db::FxHashMap; use itertools::Itertools; -use rustc_hash::FxHashMap; - use syntax::{ast, ted, AstNode}; use crate::{AssistContext, AssistId, AssistKind, Assists}; diff --git a/crates/ide_assists/src/handlers/reorder_impl.rs b/crates/ide_assists/src/handlers/reorder_impl.rs index 8ae12ab1f4..c0991c6080 100644 --- a/crates/ide_assists/src/handlers/reorder_impl.rs +++ b/crates/ide_assists/src/handlers/reorder_impl.rs @@ -1,8 +1,6 @@ -use itertools::Itertools; -use rustc_hash::FxHashMap; - use hir::{PathResolution, Semantics}; -use ide_db::RootDatabase; +use ide_db::{FxHashMap, RootDatabase}; +use itertools::Itertools; use syntax::{ ast::{self, HasName}, ted, AstNode, diff --git a/crates/ide_completion/Cargo.toml b/crates/ide_completion/Cargo.toml index 8d9381e09a..a82223ca90 100644 --- a/crates/ide_completion/Cargo.toml +++ b/crates/ide_completion/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] cov-mark = "2.0.0-pre.1" itertools = "0.10.3" -rustc-hash = "1.1.0" + once_cell = "1.10.0" smallvec = "1.8.0" diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs index eb887c3f73..09ba672a14 100644 --- a/crates/ide_completion/src/completions/attribute.rs +++ b/crates/ide_completion/src/completions/attribute.rs @@ -7,11 +7,10 @@ use ide_db::{ Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS, }, syntax_helpers::node_ext::parse_tt_as_comma_sep_paths, - SymbolKind, + FxHashMap, SymbolKind, }; use itertools::Itertools; use once_cell::sync::Lazy; -use rustc_hash::FxHashMap; use syntax::{ ast::{self, AttrKind}, AstNode, SyntaxKind, T, diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs index 9eb9da1b1b..f9df33d88b 100644 --- a/crates/ide_completion/src/completions/dot.rs +++ b/crates/ide_completion/src/completions/dot.rs @@ -1,6 +1,6 @@ //! Completes references after dot (fields and method calls). -use rustc_hash::FxHashSet; +use ide_db::FxHashSet; use crate::{context::CompletionContext, patterns::ImmediateLocation, Completions}; diff --git a/crates/ide_completion/src/completions/fn_param.rs b/crates/ide_completion/src/completions/fn_param.rs index ae09339e95..c010c49489 100644 --- a/crates/ide_completion/src/completions/fn_param.rs +++ b/crates/ide_completion/src/completions/fn_param.rs @@ -1,7 +1,7 @@ //! See [`complete_fn_param`]. use hir::HirDisplay; -use rustc_hash::FxHashMap; +use ide_db::FxHashMap; use syntax::{ algo, ast::{self, HasModuleItem}, diff --git a/crates/ide_completion/src/completions/mod_.rs b/crates/ide_completion/src/completions/mod_.rs index 7641086ff8..5551934da9 100644 --- a/crates/ide_completion/src/completions/mod_.rs +++ b/crates/ide_completion/src/completions/mod_.rs @@ -3,11 +3,11 @@ use std::iter; use hir::{Module, ModuleSource}; +use ide_db::FxHashSet; use ide_db::{ base_db::{SourceDatabaseExt, VfsPath}, RootDatabase, SymbolKind, }; -use rustc_hash::FxHashSet; use crate::{context::NameContext, CompletionItem}; diff --git a/crates/ide_completion/src/completions/pattern.rs b/crates/ide_completion/src/completions/pattern.rs index a11bcc96fa..16666eba45 100644 --- a/crates/ide_completion/src/completions/pattern.rs +++ b/crates/ide_completion/src/completions/pattern.rs @@ -1,7 +1,7 @@ //! Completes constants and paths in unqualified patterns. use hir::{db::DefDatabase, AssocItem, ScopeDef}; -use rustc_hash::FxHashSet; +use ide_db::FxHashSet; use syntax::ast::Pat; use crate::{ diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index 534d27d983..2c2fe524ef 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs @@ -1,7 +1,7 @@ //! Completion of paths, i.e. `some::prefix::$0`. use hir::{ScopeDef, Trait}; -use rustc_hash::FxHashSet; +use ide_db::FxHashSet; use syntax::ast; use crate::{ diff --git a/crates/ide_completion/src/completions/use_.rs b/crates/ide_completion/src/completions/use_.rs index 07f14c8735..25eb3fb908 100644 --- a/crates/ide_completion/src/completions/use_.rs +++ b/crates/ide_completion/src/completions/use_.rs @@ -1,7 +1,7 @@ //! Completion for use trees use hir::ScopeDef; -use rustc_hash::FxHashSet; +use ide_db::FxHashSet; use syntax::{ast, AstNode}; use crate::{ diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index a98e10a226..f75aa8f9ff 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs @@ -10,9 +10,8 @@ use ide_db::{ active_parameter::ActiveParameter, base_db::{FilePosition, SourceDatabase}, famous_defs::FamousDefs, - RootDatabase, + FxHashMap, FxHashSet, RootDatabase, }; -use rustc_hash::{FxHashMap, FxHashSet}; use syntax::{ algo::{find_node_at_offset, non_trivia_sibling}, ast::{self, AttrKind, HasName, NameOrNameRef}, diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 5abeb88837..8fad4ac0f3 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs @@ -49,9 +49,9 @@ use hir::{ db::{AstDatabase, DefDatabase, HirDatabase}, symbols::FileSymbolKind, }; -use rustc_hash::FxHashSet; use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; +pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; /// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience. pub use base_db; diff --git a/crates/ide_diagnostics/Cargo.toml b/crates/ide_diagnostics/Cargo.toml index 3d3eba3ba4..20bd4a2ed2 100644 --- a/crates/ide_diagnostics/Cargo.toml +++ b/crates/ide_diagnostics/Cargo.toml @@ -12,7 +12,8 @@ doctest = false [dependencies] cov-mark = "2.0.0-pre.1" itertools = "0.10.3" -rustc-hash = "1.1.0" + + either = "1.6.1" profile = { path = "../profile", version = "0.0.0" } diff --git a/crates/ide_diagnostics/src/handlers/missing_fields.rs b/crates/ide_diagnostics/src/handlers/missing_fields.rs index 6b70db9bfd..3160004380 100644 --- a/crates/ide_diagnostics/src/handlers/missing_fields.rs +++ b/crates/ide_diagnostics/src/handlers/missing_fields.rs @@ -3,8 +3,7 @@ use hir::{ db::{AstDatabase, HirDatabase}, known, AssocItem, HirDisplay, InFile, Type, }; -use ide_db::{assists::Assist, famous_defs::FamousDefs, source_change::SourceChange}; -use rustc_hash::FxHashMap; +use ide_db::{assists::Assist, famous_defs::FamousDefs, source_change::SourceChange, FxHashMap}; use stdx::format_to; use syntax::{ algo, diff --git a/crates/ide_diagnostics/src/lib.rs b/crates/ide_diagnostics/src/lib.rs index b04da2e092..1d4ea461d0 100644 --- a/crates/ide_diagnostics/src/lib.rs +++ b/crates/ide_diagnostics/src/lib.rs @@ -59,9 +59,8 @@ use ide_db::{ base_db::{FileId, SourceDatabase}, label::Label, source_change::SourceChange, - RootDatabase, + FxHashSet, RootDatabase, }; -use rustc_hash::FxHashSet; use syntax::{ast::AstNode, TextRange}; #[derive(Copy, Clone, Debug, PartialEq)] diff --git a/crates/ide_ssr/Cargo.toml b/crates/ide_ssr/Cargo.toml index db6991d4e5..a736b900ec 100644 --- a/crates/ide_ssr/Cargo.toml +++ b/crates/ide_ssr/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] cov-mark = "2.0.0-pre.1" -rustc-hash = "1.1.0" + itertools = "0.10.3" text_edit = { path = "../text_edit", version = "0.0.0" } diff --git a/crates/ide_ssr/src/lib.rs b/crates/ide_ssr/src/lib.rs index 4db8034212..7b4e53ed24 100644 --- a/crates/ide_ssr/src/lib.rs +++ b/crates/ide_ssr/src/lib.rs @@ -80,15 +80,15 @@ mod errors; #[cfg(test)] mod tests; -use crate::errors::bail; -pub use crate::errors::SsrError; -pub use crate::from_comment::ssr_from_comment; -pub use crate::matching::Match; -use crate::matching::MatchFailureReason; +pub use crate::{errors::SsrError, from_comment::ssr_from_comment, matching::Match}; + +use crate::{errors::bail, matching::MatchFailureReason}; use hir::Semantics; -use ide_db::base_db::{FileId, FilePosition, FileRange}; +use ide_db::{ + base_db::{FileId, FilePosition, FileRange}, + FxHashMap, +}; use resolving::ResolvedRule; -use rustc_hash::FxHashMap; use syntax::{ast, AstNode, SyntaxNode, TextRange}; use text_edit::TextEdit; diff --git a/crates/ide_ssr/src/matching.rs b/crates/ide_ssr/src/matching.rs index ba5aa0cc94..ba2a99c5d4 100644 --- a/crates/ide_ssr/src/matching.rs +++ b/crates/ide_ssr/src/matching.rs @@ -7,13 +7,11 @@ use crate::{ SsrMatches, }; use hir::Semantics; -use ide_db::base_db::FileRange; -use rustc_hash::FxHashMap; +use ide_db::{base_db::FileRange, FxHashMap}; use std::{cell::Cell, iter::Peekable}; -use syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken}; use syntax::{ - ast::{AstNode, AstToken}, - SmolStr, + ast::{self, AstNode, AstToken}, + SmolStr, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken, }; // Creates a match error. If we're currently attempting to match some code that we thought we were diff --git a/crates/ide_ssr/src/nester.rs b/crates/ide_ssr/src/nester.rs index e734125ec8..0c1b2685b2 100644 --- a/crates/ide_ssr/src/nester.rs +++ b/crates/ide_ssr/src/nester.rs @@ -7,10 +7,11 @@ //! then we'll get 3 matches, however only the outermost and innermost matches can be accepted. The //! middle match would take the second `foo` from the outer match. -use crate::{Match, SsrMatches}; -use rustc_hash::FxHashMap; +use ide_db::FxHashMap; use syntax::SyntaxNode; +use crate::{Match, SsrMatches}; + pub(crate) fn nest_and_remove_collisions( mut matches: Vec, sema: &hir::Semantics, diff --git a/crates/ide_ssr/src/parsing.rs b/crates/ide_ssr/src/parsing.rs index aaaee576b5..f6220b928a 100644 --- a/crates/ide_ssr/src/parsing.rs +++ b/crates/ide_ssr/src/parsing.rs @@ -4,7 +4,7 @@ //! placeholders, which start with `$`. For replacement templates, this is the final form. For //! search patterns, we go further and parse the pattern as each kind of thing that we can match. //! e.g. expressions, type references etc. -use rustc_hash::{FxHashMap, FxHashSet}; +use ide_db::{FxHashMap, FxHashSet}; use std::{fmt::Display, str::FromStr}; use syntax::{SmolStr, SyntaxKind, SyntaxNode, T}; diff --git a/crates/ide_ssr/src/replacing.rs b/crates/ide_ssr/src/replacing.rs index 6d21bad1eb..1726d5701a 100644 --- a/crates/ide_ssr/src/replacing.rs +++ b/crates/ide_ssr/src/replacing.rs @@ -1,14 +1,15 @@ //! Code for applying replacement templates for matches that have previously been found. -use crate::fragments; -use crate::{resolving::ResolvedRule, Match, SsrMatches}; +use ide_db::{FxHashMap, FxHashSet}; use itertools::Itertools; -use rustc_hash::{FxHashMap, FxHashSet}; -use syntax::ast::{self, AstNode, AstToken}; -use syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; - +use syntax::{ + ast::{self, AstNode, AstToken}, + SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize, +}; use text_edit::TextEdit; +use crate::{fragments, resolving::ResolvedRule, Match, SsrMatches}; + /// Returns a text edit that will replace each match in `matches` with its corresponding replacement /// template. Placeholders in the template will have been substituted with whatever they matched to /// in the original code. diff --git a/crates/ide_ssr/src/resolving.rs b/crates/ide_ssr/src/resolving.rs index 84bf792fe0..d46ca05e55 100644 --- a/crates/ide_ssr/src/resolving.rs +++ b/crates/ide_ssr/src/resolving.rs @@ -1,13 +1,12 @@ //! This module is responsible for resolving paths within rules. -use crate::errors::error; -use crate::{parsing, SsrError}; use hir::AsAssocItem; -use ide_db::base_db::FilePosition; +use ide_db::{base_db::FilePosition, FxHashMap}; use parsing::Placeholder; -use rustc_hash::FxHashMap; use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; +use crate::{errors::error, parsing, SsrError}; + pub(crate) struct ResolutionScope<'db> { scope: hir::SemanticsScope<'db>, node: SyntaxNode, diff --git a/crates/ide_ssr/src/search.rs b/crates/ide_ssr/src/search.rs index ffecffc46d..0a85569b60 100644 --- a/crates/ide_ssr/src/search.rs +++ b/crates/ide_ssr/src/search.rs @@ -9,8 +9,8 @@ use ide_db::{ base_db::{FileId, FileRange}, defs::Definition, search::{SearchScope, UsageSearchResult}, + FxHashSet, }; -use rustc_hash::FxHashSet; use syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; /// A cache for the results of find_usages. This is for when we have multiple patterns that have the diff --git a/crates/ide_ssr/src/tests.rs b/crates/ide_ssr/src/tests.rs index 26a043dc98..e86190564c 100644 --- a/crates/ide_ssr/src/tests.rs +++ b/crates/ide_ssr/src/tests.rs @@ -1,10 +1,13 @@ -use crate::{MatchFinder, SsrRule}; use expect_test::{expect, Expect}; -use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; -use rustc_hash::FxHashSet; +use ide_db::{ + base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}, + FxHashSet, +}; use std::sync::Arc; use test_utils::RangeOrOffset; +use crate::{MatchFinder, SsrRule}; + fn parse_error_text(query: &str) -> String { format!("{}", query.parse::().unwrap_err()) }