Unnamed repository; edit this file 'description' to name the repository.
minor: Lift out FxIndex{Map/Set} types into ide_db
Lukas Wirth 2021-11-16
parent d2513de · commit 92f7db4
-rw-r--r--Cargo.lock3
-rw-r--r--crates/hir_def/Cargo.toml2
-rw-r--r--crates/ide/Cargo.toml1
-rw-r--r--crates/ide/src/call_hierarchy.rs6
-rw-r--r--crates/ide_assists/Cargo.toml1
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs7
-rw-r--r--crates/ide_db/Cargo.toml1
-rw-r--r--crates/ide_db/src/lib.rs4
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--crates/vfs/Cargo.toml2
10 files changed, 13 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ba355216a8..5a62bccf6b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -585,7 +585,6 @@ dependencies = [
"ide_db",
"ide_diagnostics",
"ide_ssr",
- "indexmap",
"itertools",
"oorandom",
"profile",
@@ -609,7 +608,6 @@ dependencies = [
"expect-test",
"hir",
"ide_db",
- "indexmap",
"itertools",
"profile",
"rustc-hash",
@@ -654,6 +652,7 @@ dependencies = [
"expect-test",
"fst",
"hir",
+ "indexmap",
"itertools",
"limit",
"once_cell",
diff --git a/crates/hir_def/Cargo.toml b/crates/hir_def/Cargo.toml
index 3261577df0..8672ce6615 100644
--- a/crates/hir_def/Cargo.toml
+++ b/crates/hir_def/Cargo.toml
@@ -20,7 +20,7 @@ anymap = "0.12.1"
drop_bomb = "0.1.4"
fst = { version = "0.4", default-features = false }
itertools = "0.10.0"
-indexmap = "1.4.0"
+indexmap = "1.7.0"
smallvec = "1.4.0"
la-arena = { version = "0.3.0", path = "../../lib/arena" }
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml
index aef8e367f2..3403b5a631 100644
--- a/crates/ide/Cargo.toml
+++ b/crates/ide/Cargo.toml
@@ -12,7 +12,6 @@ doctest = false
[dependencies]
cov-mark = "2.0.0-pre.1"
either = "1.5.3"
-indexmap = "1.4.0"
itertools = "0.10.0"
tracing = "0.1"
rustc-hash = "1.1.0"
diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs
index 23bffd5648..30614a9b49 100644
--- a/crates/ide/src/call_hierarchy.rs
+++ b/crates/ide/src/call_hierarchy.rs
@@ -1,13 +1,11 @@
//! Entry point for call-hierarchy
-use indexmap::IndexMap;
-
use hir::Semantics;
use ide_db::{
defs::{Definition, NameClass, NameRefClass},
helpers::pick_best_token,
search::FileReference,
- RootDatabase,
+ FxIndexMap, RootDatabase,
};
use syntax::{ast, AstNode, SyntaxKind::NAME, TextRange};
@@ -125,7 +123,7 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
#[derive(Default)]
struct CallLocations {
- funcs: IndexMap<NavigationTarget, Vec<TextRange>>,
+ funcs: FxIndexMap<NavigationTarget, Vec<TextRange>>,
}
impl CallLocations {
diff --git a/crates/ide_assists/Cargo.toml b/crates/ide_assists/Cargo.toml
index de5dd6cb79..4d97e9150e 100644
--- a/crates/ide_assists/Cargo.toml
+++ b/crates/ide_assists/Cargo.toml
@@ -14,7 +14,6 @@ cov-mark = "2.0.0-pre.1"
rustc-hash = "1.1.0"
itertools = "0.10.0"
either = "1.6.1"
-indexmap = "1.6.2"
stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" }
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index 3a334efe0a..e2845bc58b 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -1,4 +1,4 @@
-use std::{hash::BuildHasherDefault, iter};
+use std::iter;
use ast::make;
use either::Either;
@@ -12,10 +12,9 @@ use ide_db::{
FamousDefs,
},
search::{FileReference, ReferenceCategory, SearchScope},
- RootDatabase,
+ FxIndexSet, RootDatabase,
};
use itertools::Itertools;
-use rustc_hash::FxHasher;
use stdx::format_to;
use syntax::{
ast::{
@@ -33,8 +32,6 @@ use crate::{
AssistId,
};
-type FxIndexSet<T> = indexmap::IndexSet<T, BuildHasherDefault<FxHasher>>;
-
// Assist: extract_function
//
// Extracts selected statements into new function.
diff --git a/crates/ide_db/Cargo.toml b/crates/ide_db/Cargo.toml
index d6586185c5..ea20f5372c 100644
--- a/crates/ide_db/Cargo.toml
+++ b/crates/ide_db/Cargo.toml
@@ -19,6 +19,7 @@ once_cell = "1.3.1"
either = "1.6.1"
itertools = "0.10.0"
arrayvec = "0.7"
+indexmap = "1.7"
stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" }
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs
index eaa9291fce..77db09315d 100644
--- a/crates/ide_db/src/lib.rs
+++ b/crates/ide_db/src/lib.rs
@@ -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.
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(
base_db::SourceDatabaseStorage,
base_db::SourceDatabaseExtStorage,
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index c3d08acb27..8705fb2115 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -17,7 +17,7 @@ rowan = "0.14.0"
rustc_lexer = { version = "725.0.0", package = "rustc-ap-rustc_lexer" }
rustc-hash = "1.1.0"
once_cell = "1.3.1"
-indexmap = "1.4.0"
+indexmap = "1.7.0"
smol_str = "0.1.21"
stdx = { path = "../stdx", version = "0.0.0" }
diff --git a/crates/vfs/Cargo.toml b/crates/vfs/Cargo.toml
index f77e56f13e..2c62626b75 100644
--- a/crates/vfs/Cargo.toml
+++ b/crates/vfs/Cargo.toml
@@ -14,4 +14,4 @@ rustc-hash = "1.0"
fst = "0.4"
paths = { path = "../paths", version = "0.0.0" }
-indexmap = "1.6.2"
+indexmap = "1.7"