Skip to content

Commit 85dd7b2

Browse files
committed
Use nohash_hasher, rm comment
1 parent 7e1992a commit 85dd7b2

File tree

11 files changed

+21
-123
lines changed

11 files changed

+21
-123
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ toolchain = { path = "./crates/toolchain", version = "0.0.0" }
7474
tt = { path = "./crates/tt", version = "0.0.0" }
7575
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
7676
vfs = { path = "./crates/vfs", version = "0.0.0" }
77+
line-index = { version = "0.1.0", path = "./lib/line-index" }
7778

7879
# non-local crates
7980
smallvec = { version = "1.10.0", features = ["const_new", "union", "const_generics"] }
8081
smol_str = "0.2.0"
82+
nohash-hasher = "0.2.0"
8183
# the following crates are pinned to prevent us from pulling in syn 2 until all our dependencies have moved
8284
serde = { version = "=1.0.156", features = ["derive"] }
8385
serde_json = "1.0.94"

crates/ide-db/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ text-edit.workspace = true
3737
# something from some `hir-xxx` subpackage, reexport the API via `hir`.
3838
hir.workspace = true
3939

40-
# used to be a module, turned into its own library
41-
line-index = { version = "0.1.0", path = "../../lib/line-index" }
40+
line-index.workspace = true
4241

4342
[dev-dependencies]
4443
expect-test = "1.4.0"

crates/stdx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ doctest = false
1515
libc = "0.2.135"
1616
backtrace = { version = "0.3.65", optional = true }
1717
always-assert = { version = "0.1.2", features = ["log"] }
18-
non-hash = { version = "0.1.0", path = "../../lib/non-hash" }
18+
nohash-hasher.workspace = true
1919
# Think twice before adding anything here
2020

2121
[target.'cfg(windows)'.dependencies]

crates/stdx/src/hash.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! Re-exports from [`nohash_hasher`].
2+
3+
pub use nohash_hasher::IntMap as NoHashHashMap;
4+
pub use nohash_hasher::IntSet as NoHashHashSet;
5+
pub use nohash_hasher::IsEnabled;

crates/stdx/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pub mod process;
1111
pub mod panic_context;
1212
pub mod non_empty_vec;
1313
pub mod rand;
14+
pub mod hash;
1415

1516
pub use always_assert::{always, never};
16-
pub use non_hash as hash;
1717

1818
#[inline(always)]
1919
pub fn is_ci() -> bool {

crates/vfs/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ pub use paths::{AbsPath, AbsPathBuf};
6262
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
6363
pub struct FileId(pub u32);
6464

65-
impl stdx::hash::NoHashHashable for FileId {}
65+
/// safe because `FileId` is a newtype of `u32`
66+
impl stdx::hash::IsEnabled for FileId {}
6667

6768
/// Storage for all files read by rust-analyzer.
6869
///

lib/line-index/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name = "line-index"
33
version = "0.1.0"
44
description = "Maps flat `TextSize` offsets into `(line, column)` representation."
55
license = "MIT OR Apache-2.0"
6-
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/non-hash"
6+
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/line-index"
77
edition = "2021"
88

99
[dependencies]
1010
text-size = "1"
11-
non-hash = { version = "0.1.0", path = "../non-hash" }
11+
nohash-hasher.workspace = true

lib/line-index/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod tests;
77

88
use std::{iter, mem};
99

10-
use non_hash::NoHashHashMap;
10+
use nohash_hasher::IntMap as NoHashHashMap;
1111
use text_size::{TextRange, TextSize};
1212

1313
/// Maps flat [`TextSize`] offsets into `(line, column)` representation.

lib/non-hash/Cargo.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)