Re-export FxHashMap and FxHashSet from ide_db

This commit is contained in:
Lukas Wirth 2022-04-25 18:51:59 +02:00
parent 8154365b00
commit 4255996965
43 changed files with 70 additions and 94 deletions

5
Cargo.lock generated
View file

@ -606,7 +606,6 @@ dependencies = [
"profile", "profile",
"pulldown-cmark", "pulldown-cmark",
"pulldown-cmark-to-cmark", "pulldown-cmark-to-cmark",
"rustc-hash",
"stdx", "stdx",
"syntax", "syntax",
"test_utils", "test_utils",
@ -627,7 +626,6 @@ dependencies = [
"ide_db", "ide_db",
"itertools", "itertools",
"profile", "profile",
"rustc-hash",
"sourcegen", "sourcegen",
"stdx", "stdx",
"syntax", "syntax",
@ -647,7 +645,6 @@ dependencies = [
"itertools", "itertools",
"once_cell", "once_cell",
"profile", "profile",
"rustc-hash",
"smallvec", "smallvec",
"stdx", "stdx",
"syntax", "syntax",
@ -695,7 +692,6 @@ dependencies = [
"ide_db", "ide_db",
"itertools", "itertools",
"profile", "profile",
"rustc-hash",
"sourcegen", "sourcegen",
"stdx", "stdx",
"syntax", "syntax",
@ -713,7 +709,6 @@ dependencies = [
"ide_db", "ide_db",
"itertools", "itertools",
"parser", "parser",
"rustc-hash",
"syntax", "syntax",
"test_utils", "test_utils",
"text_edit", "text_edit",

View file

@ -15,7 +15,6 @@ crossbeam-channel = "0.5.4"
either = "1.6.1" either = "1.6.1"
itertools = "0.10.3" itertools = "0.10.3"
tracing = "0.1.32" tracing = "0.1.32"
rustc-hash = "1.1.0"
oorandom = "11.1.3" oorandom = "11.1.3"
pulldown-cmark-to-cmark = "10.0.1" pulldown-cmark-to-cmark = "10.0.1"
pulldown-cmark = { version = "0.9.1", default-features = false } pulldown-cmark = { version = "0.9.1", default-features = false }

View file

@ -1,6 +1,4 @@
use ide_db::syntax_helpers::node_ext::vis_eq; use ide_db::{syntax_helpers::node_ext::vis_eq, FxHashSet};
use rustc_hash::FxHashSet;
use syntax::{ use syntax::{
ast::{self, AstNode, AstToken}, ast::{self, AstNode, AstToken},
match_ast, Direction, NodeOrToken, SourceFile, match_ast, Direction, NodeOrToken, SourceFile,

View file

@ -5,9 +5,8 @@ use ide_db::{
helpers::pick_best_token, helpers::pick_best_token,
search::{FileReference, ReferenceCategory, SearchScope}, search::{FileReference, ReferenceCategory, SearchScope},
syntax_helpers::node_ext::{for_each_break_and_continue_expr, for_each_tail_expr, walk_expr}, 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::{ use syntax::{
ast::{self, HasLoopBody}, ast::{self, HasLoopBody},
match_ast, AstNode, match_ast, AstNode,

View file

@ -1,10 +1,10 @@
use either::Either; use either::Either;
use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo}; use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo};
use ide_db::{ 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 itertools::Itertools;
use rustc_hash::FxHashMap;
use stdx::to_lower_snake_case; use stdx::to_lower_snake_case;
use syntax::{ use syntax::{
ast::{self, AstNode, HasArgList, HasGenericParams, HasName, UnaryOp}, ast::{self, AstNode, HasArgList, HasGenericParams, HasName, UnaryOp},

View file

@ -12,9 +12,8 @@ use ide_db::{
salsa::{Database, ParallelDatabase, Snapshot}, salsa::{Database, ParallelDatabase, Snapshot},
Cancelled, CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt, Cancelled, CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt,
}, },
FxIndexMap, FxHashSet, FxIndexMap,
}; };
use rustc_hash::FxHashSet;
use crate::RootDatabase; use crate::RootDatabase;

View file

@ -1,7 +1,7 @@
//! helper data structure to schedule work for parallel prime caches. //! helper data structure to schedule work for parallel prime caches.
use std::{collections::VecDeque, hash::Hash}; use std::{collections::VecDeque, hash::Hash};
use rustc_hash::FxHashMap; use ide_db::FxHashMap;
pub(crate) struct TopologicSortIterBuilder<T> { pub(crate) struct TopologicSortIterBuilder<T> {
nodes: FxHashMap<T, Entry<T>>, nodes: FxHashMap<T, Entry<T>>,

View file

@ -14,9 +14,8 @@ use ide_db::{
base_db::FileId, base_db::FileId,
defs::{Definition, NameClass, NameRefClass}, defs::{Definition, NameClass, NameRefClass},
search::{ReferenceCategory, SearchScope, UsageSearchResult}, search::{ReferenceCategory, SearchScope, UsageSearchResult},
RootDatabase, FxHashMap, RootDatabase,
}; };
use rustc_hash::FxHashMap;
use syntax::{ use syntax::{
algo::find_node_at_offset, algo::find_node_at_offset,
ast::{self, HasName}, ast::{self, HasName},

View file

@ -9,10 +9,9 @@ use ide_db::{
defs::Definition, defs::Definition,
helpers::visit_file_defs, helpers::visit_file_defs,
search::SearchScope, search::SearchScope,
RootDatabase, SymbolKind, FxHashMap, FxHashSet, RootDatabase, SymbolKind,
}; };
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};
use stdx::{always, format_to}; use stdx::{always, format_to};
use syntax::{ use syntax::{
ast::{self, AstNode, HasAttrs as _}, ast::{self, AstNode, HasAttrs as _},

View file

@ -1,9 +1,9 @@
use std::sync::Arc; use std::sync::Arc;
use ide_db::base_db::salsa::Durability; use ide_db::{
use ide_db::base_db::{CrateGraph, SourceDatabase}; base_db::{salsa::Durability, CrateGraph, SourceDatabase},
use ide_db::RootDatabase; FxHashMap, RootDatabase,
use rustc_hash::FxHashMap; };
// Feature: Shuffle Crate Graph // Feature: Shuffle Crate Graph
// //

View file

@ -63,9 +63,8 @@ mod tests {
use ide_db::{ use ide_db::{
base_db::{fixture::WithFixture, salsa::Durability, FileRange}, base_db::{fixture::WithFixture, salsa::Durability, FileRange},
symbol_index::SymbolsDatabase, symbol_index::SymbolsDatabase,
RootDatabase, FxHashSet, RootDatabase,
}; };
use rustc_hash::FxHashSet;
use super::ssr_assists; use super::ssr_assists;

View file

@ -7,9 +7,8 @@ use hir::{db::HirDatabase, Crate, Module, Semantics};
use ide_db::{ use ide_db::{
base_db::{FileId, FileRange, SourceDatabaseExt}, base_db::{FileId, FileRange, SourceDatabaseExt},
defs::{Definition, IdentClass}, defs::{Definition, IdentClass},
RootDatabase, FxHashSet, RootDatabase,
}; };
use rustc_hash::FxHashSet;
use syntax::{AstNode, SyntaxKind::*, SyntaxToken, TextRange, T}; use syntax::{AstNode, SyntaxKind::*, SyntaxToken, TextRange, T};
use crate::{ use crate::{

View file

@ -14,8 +14,7 @@ mod html;
mod tests; mod tests;
use hir::{InFile, Name, Semantics}; use hir::{InFile, Name, Semantics};
use ide_db::RootDatabase; use ide_db::{FxHashMap, RootDatabase};
use rustc_hash::FxHashMap;
use syntax::{ use syntax::{
ast, AstNode, AstToken, NodeOrToken, SyntaxKind::*, SyntaxNode, TextRange, WalkEvent, T, ast, AstNode, AstToken, NodeOrToken, SyntaxKind::*, SyntaxNode, TextRange, WalkEvent, T,
}; };

View file

@ -3,9 +3,8 @@
use hir::{AsAssocItem, HasVisibility, Semantics}; use hir::{AsAssocItem, HasVisibility, Semantics};
use ide_db::{ use ide_db::{
defs::{Definition, IdentClass, NameClass, NameRefClass}, defs::{Definition, IdentClass, NameClass, NameRefClass},
RootDatabase, SymbolKind, FxHashMap, RootDatabase, SymbolKind,
}; };
use rustc_hash::FxHashMap;
use syntax::{ use syntax::{
ast, match_ast, AstNode, AstToken, NodeOrToken, ast, match_ast, AstNode, AstToken, NodeOrToken,
SyntaxKind::{self, *}, SyntaxKind::{self, *},

View file

@ -3,9 +3,8 @@ use std::sync::Arc;
use dot::{Id, LabelText}; use dot::{Id, LabelText};
use ide_db::{ use ide_db::{
base_db::{CrateGraph, CrateId, Dependency, SourceDatabase, SourceDatabaseExt}, base_db::{CrateGraph, CrateId, Dependency, SourceDatabase, SourceDatabaseExt},
RootDatabase, FxHashSet, RootDatabase,
}; };
use rustc_hash::FxHashSet;
// Feature: View Crate Graph // Feature: View Crate Graph
// //

View file

@ -11,7 +11,7 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
rustc-hash = "1.1.0"
itertools = "0.10.3" itertools = "0.10.3"
either = "1.6.1" either = "1.6.1"

View file

@ -7,10 +7,9 @@ use ide_db::{
helpers::mod_path_to_ast, helpers::mod_path_to_ast,
imports::insert_use::{insert_use, ImportScope, InsertUseConfig}, imports::insert_use::{insert_use, ImportScope, InsertUseConfig},
search::FileReference, search::FileReference,
RootDatabase, FxHashSet, RootDatabase,
}; };
use itertools::{Itertools, Position}; use itertools::{Itertools, Position};
use rustc_hash::FxHashSet;
use syntax::{ use syntax::{
ast::{ ast::{
self, edit::IndentLevel, edit_in_place::Indent, make, AstNode, HasAttrs, HasGenericParams, self, edit::IndentLevel, edit_in_place::Indent, make, AstNode, HasAttrs, HasGenericParams,

View file

@ -1,11 +1,9 @@
use rustc_hash::{FxHashMap, FxHashSet};
use hir::{HasSource, HirDisplay, Module, Semantics, TypeInfo}; use hir::{HasSource, HirDisplay, Module, Semantics, TypeInfo};
use ide_db::{ use ide_db::{
base_db::FileId, base_db::FileId,
defs::{Definition, NameRefClass}, defs::{Definition, NameRefClass},
famous_defs::FamousDefs, famous_defs::FamousDefs,
RootDatabase, SnippetCap, FxHashMap, FxHashSet, RootDatabase, SnippetCap,
}; };
use stdx::to_lower_snake_case; use stdx::to_lower_snake_case;
use syntax::{ use syntax::{

View file

@ -1,4 +1,4 @@
use rustc_hash::FxHashSet; use ide_db::FxHashSet;
use syntax::{ use syntax::{
ast::{self, edit_in_place::GenericParamsOwnerEdit, make, HasGenericParams}, ast::{self, edit_in_place::GenericParamsOwnerEdit, make, HasGenericParams},
ted::{self, Position}, ted::{self, Position},

View file

@ -1,7 +1,6 @@
use either::Either; use either::Either;
use ide_db::FxHashMap;
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::FxHashMap;
use syntax::{ast, ted, AstNode}; use syntax::{ast, ted, AstNode};
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,8 +1,6 @@
use itertools::Itertools;
use rustc_hash::FxHashMap;
use hir::{PathResolution, Semantics}; use hir::{PathResolution, Semantics};
use ide_db::RootDatabase; use ide_db::{FxHashMap, RootDatabase};
use itertools::Itertools;
use syntax::{ use syntax::{
ast::{self, HasName}, ast::{self, HasName},
ted, AstNode, ted, AstNode,

View file

@ -12,7 +12,7 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
itertools = "0.10.3" itertools = "0.10.3"
rustc-hash = "1.1.0"
once_cell = "1.10.0" once_cell = "1.10.0"
smallvec = "1.8.0" smallvec = "1.8.0"

View file

@ -7,11 +7,10 @@ use ide_db::{
Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS, Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS,
}, },
syntax_helpers::node_ext::parse_tt_as_comma_sep_paths, syntax_helpers::node_ext::parse_tt_as_comma_sep_paths,
SymbolKind, FxHashMap, SymbolKind,
}; };
use itertools::Itertools; use itertools::Itertools;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
use syntax::{ use syntax::{
ast::{self, AttrKind}, ast::{self, AttrKind},
AstNode, SyntaxKind, T, AstNode, SyntaxKind, T,

View file

@ -1,6 +1,6 @@
//! Completes references after dot (fields and method calls). //! Completes references after dot (fields and method calls).
use rustc_hash::FxHashSet; use ide_db::FxHashSet;
use crate::{context::CompletionContext, patterns::ImmediateLocation, Completions}; use crate::{context::CompletionContext, patterns::ImmediateLocation, Completions};

View file

@ -1,7 +1,7 @@
//! See [`complete_fn_param`]. //! See [`complete_fn_param`].
use hir::HirDisplay; use hir::HirDisplay;
use rustc_hash::FxHashMap; use ide_db::FxHashMap;
use syntax::{ use syntax::{
algo, algo,
ast::{self, HasModuleItem}, ast::{self, HasModuleItem},

View file

@ -3,11 +3,11 @@
use std::iter; use std::iter;
use hir::{Module, ModuleSource}; use hir::{Module, ModuleSource};
use ide_db::FxHashSet;
use ide_db::{ use ide_db::{
base_db::{SourceDatabaseExt, VfsPath}, base_db::{SourceDatabaseExt, VfsPath},
RootDatabase, SymbolKind, RootDatabase, SymbolKind,
}; };
use rustc_hash::FxHashSet;
use crate::{context::NameContext, CompletionItem}; use crate::{context::NameContext, CompletionItem};

View file

@ -1,7 +1,7 @@
//! Completes constants and paths in unqualified patterns. //! Completes constants and paths in unqualified patterns.
use hir::{db::DefDatabase, AssocItem, ScopeDef}; use hir::{db::DefDatabase, AssocItem, ScopeDef};
use rustc_hash::FxHashSet; use ide_db::FxHashSet;
use syntax::ast::Pat; use syntax::ast::Pat;
use crate::{ use crate::{

View file

@ -1,7 +1,7 @@
//! Completion of paths, i.e. `some::prefix::$0`. //! Completion of paths, i.e. `some::prefix::$0`.
use hir::{ScopeDef, Trait}; use hir::{ScopeDef, Trait};
use rustc_hash::FxHashSet; use ide_db::FxHashSet;
use syntax::ast; use syntax::ast;
use crate::{ use crate::{

View file

@ -1,7 +1,7 @@
//! Completion for use trees //! Completion for use trees
use hir::ScopeDef; use hir::ScopeDef;
use rustc_hash::FxHashSet; use ide_db::FxHashSet;
use syntax::{ast, AstNode}; use syntax::{ast, AstNode};
use crate::{ use crate::{

View file

@ -10,9 +10,8 @@ use ide_db::{
active_parameter::ActiveParameter, active_parameter::ActiveParameter,
base_db::{FilePosition, SourceDatabase}, base_db::{FilePosition, SourceDatabase},
famous_defs::FamousDefs, famous_defs::FamousDefs,
RootDatabase, FxHashMap, FxHashSet, RootDatabase,
}; };
use rustc_hash::{FxHashMap, FxHashSet};
use syntax::{ use syntax::{
algo::{find_node_at_offset, non_trivia_sibling}, algo::{find_node_at_offset, non_trivia_sibling},
ast::{self, AttrKind, HasName, NameOrNameRef}, ast::{self, AttrKind, HasName, NameOrNameRef},

View file

@ -49,9 +49,9 @@ use hir::{
db::{AstDatabase, DefDatabase, HirDatabase}, db::{AstDatabase, DefDatabase, HirDatabase},
symbols::FileSymbolKind, symbols::FileSymbolKind,
}; };
use rustc_hash::FxHashSet;
use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; 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. /// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience.
pub use base_db; pub use base_db;

View file

@ -12,7 +12,8 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
itertools = "0.10.3" itertools = "0.10.3"
rustc-hash = "1.1.0"
either = "1.6.1" either = "1.6.1"
profile = { path = "../profile", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" }

View file

@ -3,8 +3,7 @@ use hir::{
db::{AstDatabase, HirDatabase}, db::{AstDatabase, HirDatabase},
known, AssocItem, HirDisplay, InFile, Type, known, AssocItem, HirDisplay, InFile, Type,
}; };
use ide_db::{assists::Assist, famous_defs::FamousDefs, source_change::SourceChange}; use ide_db::{assists::Assist, famous_defs::FamousDefs, source_change::SourceChange, FxHashMap};
use rustc_hash::FxHashMap;
use stdx::format_to; use stdx::format_to;
use syntax::{ use syntax::{
algo, algo,

View file

@ -59,9 +59,8 @@ use ide_db::{
base_db::{FileId, SourceDatabase}, base_db::{FileId, SourceDatabase},
label::Label, label::Label,
source_change::SourceChange, source_change::SourceChange,
RootDatabase, FxHashSet, RootDatabase,
}; };
use rustc_hash::FxHashSet;
use syntax::{ast::AstNode, TextRange}; use syntax::{ast::AstNode, TextRange};
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]

View file

@ -12,7 +12,7 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
rustc-hash = "1.1.0"
itertools = "0.10.3" itertools = "0.10.3"
text_edit = { path = "../text_edit", version = "0.0.0" } text_edit = { path = "../text_edit", version = "0.0.0" }

View file

@ -80,15 +80,15 @@ mod errors;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use crate::errors::bail; pub use crate::{errors::SsrError, from_comment::ssr_from_comment, matching::Match};
pub use crate::errors::SsrError;
pub use crate::from_comment::ssr_from_comment; use crate::{errors::bail, matching::MatchFailureReason};
pub use crate::matching::Match;
use crate::matching::MatchFailureReason;
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{FileId, FilePosition, FileRange}; use ide_db::{
base_db::{FileId, FilePosition, FileRange},
FxHashMap,
};
use resolving::ResolvedRule; use resolving::ResolvedRule;
use rustc_hash::FxHashMap;
use syntax::{ast, AstNode, SyntaxNode, TextRange}; use syntax::{ast, AstNode, SyntaxNode, TextRange};
use text_edit::TextEdit; use text_edit::TextEdit;

View file

@ -7,13 +7,11 @@ use crate::{
SsrMatches, SsrMatches,
}; };
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::FileRange; use ide_db::{base_db::FileRange, FxHashMap};
use rustc_hash::FxHashMap;
use std::{cell::Cell, iter::Peekable}; use std::{cell::Cell, iter::Peekable};
use syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken};
use syntax::{ use syntax::{
ast::{AstNode, AstToken}, ast::{self, AstNode, AstToken},
SmolStr, SmolStr, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken,
}; };
// Creates a match error. If we're currently attempting to match some code that we thought we were // Creates a match error. If we're currently attempting to match some code that we thought we were

View file

@ -7,10 +7,11 @@
//! then we'll get 3 matches, however only the outermost and innermost matches can be accepted. The //! 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. //! middle match would take the second `foo` from the outer match.
use crate::{Match, SsrMatches}; use ide_db::FxHashMap;
use rustc_hash::FxHashMap;
use syntax::SyntaxNode; use syntax::SyntaxNode;
use crate::{Match, SsrMatches};
pub(crate) fn nest_and_remove_collisions( pub(crate) fn nest_and_remove_collisions(
mut matches: Vec<Match>, mut matches: Vec<Match>,
sema: &hir::Semantics<ide_db::RootDatabase>, sema: &hir::Semantics<ide_db::RootDatabase>,

View file

@ -4,7 +4,7 @@
//! placeholders, which start with `$`. For replacement templates, this is the final form. For //! 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. //! search patterns, we go further and parse the pattern as each kind of thing that we can match.
//! e.g. expressions, type references etc. //! e.g. expressions, type references etc.
use rustc_hash::{FxHashMap, FxHashSet}; use ide_db::{FxHashMap, FxHashSet};
use std::{fmt::Display, str::FromStr}; use std::{fmt::Display, str::FromStr};
use syntax::{SmolStr, SyntaxKind, SyntaxNode, T}; use syntax::{SmolStr, SyntaxKind, SyntaxNode, T};

View file

@ -1,14 +1,15 @@
//! Code for applying replacement templates for matches that have previously been found. //! Code for applying replacement templates for matches that have previously been found.
use crate::fragments; use ide_db::{FxHashMap, FxHashSet};
use crate::{resolving::ResolvedRule, Match, SsrMatches};
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet}; use syntax::{
use syntax::ast::{self, AstNode, AstToken}; ast::{self, AstNode, AstToken},
use syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize}; SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
};
use text_edit::TextEdit; 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 /// 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 /// template. Placeholders in the template will have been substituted with whatever they matched to
/// in the original code. /// in the original code.

View file

@ -1,13 +1,12 @@
//! This module is responsible for resolving paths within rules. //! This module is responsible for resolving paths within rules.
use crate::errors::error;
use crate::{parsing, SsrError};
use hir::AsAssocItem; use hir::AsAssocItem;
use ide_db::base_db::FilePosition; use ide_db::{base_db::FilePosition, FxHashMap};
use parsing::Placeholder; use parsing::Placeholder;
use rustc_hash::FxHashMap;
use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken};
use crate::{errors::error, parsing, SsrError};
pub(crate) struct ResolutionScope<'db> { pub(crate) struct ResolutionScope<'db> {
scope: hir::SemanticsScope<'db>, scope: hir::SemanticsScope<'db>,
node: SyntaxNode, node: SyntaxNode,

View file

@ -9,8 +9,8 @@ use ide_db::{
base_db::{FileId, FileRange}, base_db::{FileId, FileRange},
defs::Definition, defs::Definition,
search::{SearchScope, UsageSearchResult}, search::{SearchScope, UsageSearchResult},
FxHashSet,
}; };
use rustc_hash::FxHashSet;
use syntax::{ast, AstNode, SyntaxKind, SyntaxNode}; 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 /// A cache for the results of find_usages. This is for when we have multiple patterns that have the

View file

@ -1,10 +1,13 @@
use crate::{MatchFinder, SsrRule};
use expect_test::{expect, Expect}; use expect_test::{expect, Expect};
use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; use ide_db::{
use rustc_hash::FxHashSet; base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt},
FxHashSet,
};
use std::sync::Arc; use std::sync::Arc;
use test_utils::RangeOrOffset; use test_utils::RangeOrOffset;
use crate::{MatchFinder, SsrRule};
fn parse_error_text(query: &str) -> String { fn parse_error_text(query: &str) -> String {
format!("{}", query.parse::<SsrRule>().unwrap_err()) format!("{}", query.parse::<SsrRule>().unwrap_err())
} }