Skip to content

Commit 4a1922f

Browse files
committed
Depend on nohash-hasher individually
1 parent 1d678cf commit 4a1922f

File tree

20 files changed

+53
-52
lines changed

20 files changed

+53
-52
lines changed

Cargo.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir-ty/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ chalk-derive = "0.89.0"
2929
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
3030
once_cell = "1.17.0"
3131
triomphe.workspace = true
32+
nohash-hasher.workspace = true
3233
typed-arena = "2.0.1"
3334
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }
3435

crates/hir-ty/src/test_db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use base_db::{
88
};
99
use hir_def::{db::DefDatabase, ModuleId};
1010
use hir_expand::db::ExpandDatabase;
11+
use nohash_hasher::IntMap;
1112
use rustc_hash::FxHashSet;
12-
use stdx::hash::NoHashHashMap;
1313
use syntax::TextRange;
1414
use test_utils::extract_annotations;
1515
use triomphe::Arc;
@@ -102,7 +102,7 @@ impl TestDB {
102102
self.module_for_file_opt(file_id).unwrap()
103103
}
104104

105-
pub(crate) fn extract_annotations(&self) -> NoHashHashMap<FileId, Vec<(TextRange, String)>> {
105+
pub(crate) fn extract_annotations(&self) -> IntMap<FileId, Vec<(TextRange, String)>> {
106106
let mut files = Vec::new();
107107
let crate_graph = self.crate_graph();
108108
for krate in crate_graph.iter() {

crates/ide-db/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ arrayvec = "0.7.2"
2424
indexmap = "1.9.1"
2525
memchr = "2.5.0"
2626
triomphe.workspace = true
27+
nohash-hasher.workspace = true
2728

2829
# local deps
2930
base-db.workspace = true

crates/ide-db/src/search.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use hir::{
1111
AsAssocItem, DefWithBody, HasAttrs, HasSource, InFile, ModuleSource, Semantics, Visibility,
1212
};
1313
use memchr::memmem::Finder;
14+
use nohash_hasher::IntMap;
1415
use once_cell::unsync::Lazy;
1516
use parser::SyntaxKind;
16-
use stdx::hash::NoHashHashMap;
1717
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
1818
use triomphe::Arc;
1919

@@ -25,7 +25,7 @@ use crate::{
2525

2626
#[derive(Debug, Default, Clone)]
2727
pub struct UsageSearchResult {
28-
pub references: NoHashHashMap<FileId, Vec<FileReference>>,
28+
pub references: IntMap<FileId, Vec<FileReference>>,
2929
}
3030

3131
impl UsageSearchResult {
@@ -50,7 +50,7 @@ impl UsageSearchResult {
5050

5151
impl IntoIterator for UsageSearchResult {
5252
type Item = (FileId, Vec<FileReference>);
53-
type IntoIter = <NoHashHashMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
53+
type IntoIter = <IntMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
5454

5555
fn into_iter(self) -> Self::IntoIter {
5656
self.references.into_iter()
@@ -84,17 +84,17 @@ pub enum ReferenceCategory {
8484
/// e.g. for things like local variables.
8585
#[derive(Clone, Debug)]
8686
pub struct SearchScope {
87-
entries: NoHashHashMap<FileId, Option<TextRange>>,
87+
entries: IntMap<FileId, Option<TextRange>>,
8888
}
8989

9090
impl SearchScope {
91-
fn new(entries: NoHashHashMap<FileId, Option<TextRange>>) -> SearchScope {
91+
fn new(entries: IntMap<FileId, Option<TextRange>>) -> SearchScope {
9292
SearchScope { entries }
9393
}
9494

9595
/// Build a search scope spanning the entire crate graph of files.
9696
fn crate_graph(db: &RootDatabase) -> SearchScope {
97-
let mut entries = NoHashHashMap::default();
97+
let mut entries = IntMap::default();
9898

9999
let graph = db.crate_graph();
100100
for krate in graph.iter() {
@@ -108,7 +108,7 @@ impl SearchScope {
108108

109109
/// Build a search scope spanning all the reverse dependencies of the given crate.
110110
fn reverse_dependencies(db: &RootDatabase, of: hir::Crate) -> SearchScope {
111-
let mut entries = NoHashHashMap::default();
111+
let mut entries = IntMap::default();
112112
for rev_dep in of.transitive_reverse_dependencies(db) {
113113
let root_file = rev_dep.root_file(db);
114114
let source_root_id = db.file_source_root(root_file);
@@ -128,7 +128,7 @@ impl SearchScope {
128128

129129
/// Build a search scope spanning the given module and all its submodules.
130130
fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope {
131-
let mut entries = NoHashHashMap::default();
131+
let mut entries = IntMap::default();
132132

133133
let (file_id, range) = {
134134
let InFile { file_id, value } = module.definition_source(db);
@@ -161,7 +161,7 @@ impl SearchScope {
161161

162162
/// Build an empty search scope.
163163
pub fn empty() -> SearchScope {
164-
SearchScope::new(NoHashHashMap::default())
164+
SearchScope::new(IntMap::default())
165165
}
166166

167167
/// Build a empty search scope spanning the given file.

crates/ide-db/src/source_change.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
66
use std::{collections::hash_map::Entry, iter, mem};
77

8+
use crate::SnippetCap;
89
use base_db::{AnchoredPathBuf, FileId};
9-
use stdx::{hash::NoHashHashMap, never};
10+
use nohash_hasher::IntMap;
11+
use stdx::never;
1012
use syntax::{algo, ast, ted, AstNode, SyntaxNode, SyntaxNodePtr, TextRange, TextSize};
1113
use text_edit::{TextEdit, TextEditBuilder};
1214

13-
use crate::SnippetCap;
14-
1515
#[derive(Default, Debug, Clone)]
1616
pub struct SourceChange {
17-
pub source_file_edits: NoHashHashMap<FileId, TextEdit>,
17+
pub source_file_edits: IntMap<FileId, TextEdit>,
1818
pub file_system_edits: Vec<FileSystemEdit>,
1919
pub is_snippet: bool,
2020
}
@@ -23,7 +23,7 @@ impl SourceChange {
2323
/// Creates a new SourceChange with the given label
2424
/// from the edits.
2525
pub fn from_edits(
26-
source_file_edits: NoHashHashMap<FileId, TextEdit>,
26+
source_file_edits: IntMap<FileId, TextEdit>,
2727
file_system_edits: Vec<FileSystemEdit>,
2828
) -> Self {
2929
SourceChange { source_file_edits, file_system_edits, is_snippet: false }
@@ -77,8 +77,8 @@ impl Extend<FileSystemEdit> for SourceChange {
7777
}
7878
}
7979

80-
impl From<NoHashHashMap<FileId, TextEdit>> for SourceChange {
81-
fn from(source_file_edits: NoHashHashMap<FileId, TextEdit>) -> SourceChange {
80+
impl From<IntMap<FileId, TextEdit>> for SourceChange {
81+
fn from(source_file_edits: IntMap<FileId, TextEdit>) -> SourceChange {
8282
SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false }
8383
}
8484
}

crates/ide-ssr/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ doctest = false
1616
cov-mark = "2.0.0-pre.1"
1717
itertools = "0.10.5"
1818
triomphe.workspace = true
19+
nohash-hasher.workspace = true
1920

2021
# local deps
2122
hir.workspace = true

crates/ide-ssr/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ pub use crate::{errors::SsrError, from_comment::ssr_from_comment, matching::Matc
8787
use crate::{errors::bail, matching::MatchFailureReason};
8888
use hir::Semantics;
8989
use ide_db::base_db::{FileId, FilePosition, FileRange};
90+
use nohash_hasher::IntMap;
9091
use resolving::ResolvedRule;
91-
use stdx::hash::NoHashHashMap;
9292
use syntax::{ast, AstNode, SyntaxNode, TextRange};
9393
use text_edit::TextEdit;
9494

@@ -168,9 +168,9 @@ impl<'db> MatchFinder<'db> {
168168
}
169169

170170
/// Finds matches for all added rules and returns edits for all found matches.
171-
pub fn edits(&self) -> NoHashHashMap<FileId, TextEdit> {
171+
pub fn edits(&self) -> IntMap<FileId, TextEdit> {
172172
use ide_db::base_db::SourceDatabaseExt;
173-
let mut matches_by_file = NoHashHashMap::default();
173+
let mut matches_by_file = IntMap::default();
174174
for m in self.matches().matches {
175175
matches_by_file
176176
.entry(m.range.file_id)

crates/ide/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ url = "2.3.1"
2424
dot = "0.1.4"
2525
smallvec.workspace = true
2626
triomphe.workspace = true
27+
nohash-hasher.workspace = true
2728

2829
# local deps
2930
cfg.workspace = true

crates/ide/src/references.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ide_db::{
1717
RootDatabase,
1818
};
1919
use itertools::Itertools;
20-
use stdx::hash::NoHashHashMap;
20+
use nohash_hasher::IntMap;
2121
use syntax::{
2222
algo::find_node_at_offset,
2323
ast::{self, HasName},
@@ -31,7 +31,7 @@ use crate::{FilePosition, NavigationTarget, TryToNav};
3131
#[derive(Debug, Clone)]
3232
pub struct ReferenceSearchResult {
3333
pub declaration: Option<Declaration>,
34-
pub references: NoHashHashMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
34+
pub references: IntMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
3535
}
3636

3737
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)