minor: Lift out FxIndex{Map/Set} types into ide_db

This commit is contained in:
Lukas Wirth 2021-11-16 12:15:47 +01:00
parent d2513deb62
commit 92f7db447c
10 changed files with 13 additions and 16 deletions

3
Cargo.lock generated
View file

@ -585,7 +585,6 @@ dependencies = [
"ide_db", "ide_db",
"ide_diagnostics", "ide_diagnostics",
"ide_ssr", "ide_ssr",
"indexmap",
"itertools", "itertools",
"oorandom", "oorandom",
"profile", "profile",
@ -609,7 +608,6 @@ dependencies = [
"expect-test", "expect-test",
"hir", "hir",
"ide_db", "ide_db",
"indexmap",
"itertools", "itertools",
"profile", "profile",
"rustc-hash", "rustc-hash",
@ -654,6 +652,7 @@ dependencies = [
"expect-test", "expect-test",
"fst", "fst",
"hir", "hir",
"indexmap",
"itertools", "itertools",
"limit", "limit",
"once_cell", "once_cell",

View file

@ -20,7 +20,7 @@ anymap = "0.12.1"
drop_bomb = "0.1.4" drop_bomb = "0.1.4"
fst = { version = "0.4", default-features = false } fst = { version = "0.4", default-features = false }
itertools = "0.10.0" itertools = "0.10.0"
indexmap = "1.4.0" indexmap = "1.7.0"
smallvec = "1.4.0" smallvec = "1.4.0"
la-arena = { version = "0.3.0", path = "../../lib/arena" } la-arena = { version = "0.3.0", path = "../../lib/arena" }

View file

@ -12,7 +12,6 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
either = "1.5.3" either = "1.5.3"
indexmap = "1.4.0"
itertools = "0.10.0" itertools = "0.10.0"
tracing = "0.1" tracing = "0.1"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"

View file

@ -1,13 +1,11 @@
//! Entry point for call-hierarchy //! Entry point for call-hierarchy
use indexmap::IndexMap;
use hir::Semantics; use hir::Semantics;
use ide_db::{ use ide_db::{
defs::{Definition, NameClass, NameRefClass}, defs::{Definition, NameClass, NameRefClass},
helpers::pick_best_token, helpers::pick_best_token,
search::FileReference, search::FileReference,
RootDatabase, FxIndexMap, RootDatabase,
}; };
use syntax::{ast, AstNode, SyntaxKind::NAME, TextRange}; use syntax::{ast, AstNode, SyntaxKind::NAME, TextRange};
@ -125,7 +123,7 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
#[derive(Default)] #[derive(Default)]
struct CallLocations { struct CallLocations {
funcs: IndexMap<NavigationTarget, Vec<TextRange>>, funcs: FxIndexMap<NavigationTarget, Vec<TextRange>>,
} }
impl CallLocations { impl CallLocations {

View file

@ -14,7 +14,6 @@ cov-mark = "2.0.0-pre.1"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
itertools = "0.10.0" itertools = "0.10.0"
either = "1.6.1" either = "1.6.1"
indexmap = "1.6.2"
stdx = { path = "../stdx", version = "0.0.0" } stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" }

View file

@ -1,4 +1,4 @@
use std::{hash::BuildHasherDefault, iter}; use std::iter;
use ast::make; use ast::make;
use either::Either; use either::Either;
@ -12,10 +12,9 @@ use ide_db::{
FamousDefs, FamousDefs,
}, },
search::{FileReference, ReferenceCategory, SearchScope}, search::{FileReference, ReferenceCategory, SearchScope},
RootDatabase, FxIndexSet, RootDatabase,
}; };
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::FxHasher;
use stdx::format_to; use stdx::format_to;
use syntax::{ use syntax::{
ast::{ ast::{
@ -33,8 +32,6 @@ use crate::{
AssistId, AssistId,
}; };
type FxIndexSet<T> = indexmap::IndexSet<T, BuildHasherDefault<FxHasher>>;
// Assist: extract_function // Assist: extract_function
// //
// Extracts selected statements into new function. // Extracts selected statements into new function.

View file

@ -19,6 +19,7 @@ once_cell = "1.3.1"
either = "1.6.1" either = "1.6.1"
itertools = "0.10.0" itertools = "0.10.0"
arrayvec = "0.7" arrayvec = "0.7"
indexmap = "1.7"
stdx = { path = "../stdx", version = "0.0.0" } stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" }

View file

@ -34,6 +34,10 @@ use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase};
/// `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;
pub type FxIndexSet<T> = indexmap::IndexSet<T, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
pub type FxIndexMap<K, V> =
indexmap::IndexMap<K, V, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
#[salsa::database( #[salsa::database(
base_db::SourceDatabaseStorage, base_db::SourceDatabaseStorage,
base_db::SourceDatabaseExtStorage, base_db::SourceDatabaseExtStorage,

View file

@ -17,7 +17,7 @@ rowan = "0.14.0"
rustc_lexer = { version = "725.0.0", package = "rustc-ap-rustc_lexer" } rustc_lexer = { version = "725.0.0", package = "rustc-ap-rustc_lexer" }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
once_cell = "1.3.1" once_cell = "1.3.1"
indexmap = "1.4.0" indexmap = "1.7.0"
smol_str = "0.1.21" smol_str = "0.1.21"
stdx = { path = "../stdx", version = "0.0.0" } stdx = { path = "../stdx", version = "0.0.0" }

View file

@ -14,4 +14,4 @@ rustc-hash = "1.0"
fst = "0.4" fst = "0.4"
paths = { path = "../paths", version = "0.0.0" } paths = { path = "../paths", version = "0.0.0" }
indexmap = "1.6.2" indexmap = "1.7"