mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Make use of NoHash hashing for FileId and CrateId
This commit is contained in:
parent
8dcf4c70c4
commit
d025c5d8d6
22 changed files with 189 additions and 72 deletions
|
@ -59,9 +59,16 @@ pub use paths::{AbsPath, AbsPathBuf};
|
|||
/// Handle to a file in [`Vfs`]
|
||||
///
|
||||
/// Most functions in rust-analyzer use this when they need to refer to a file.
|
||||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
|
||||
pub struct FileId(pub u32);
|
||||
|
||||
impl stdx::hash::NoHashHashable for FileId {}
|
||||
impl std::hash::Hash for FileId {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.0.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage for all files read by rust-analyzer.
|
||||
///
|
||||
/// For more information see the [crate-level](crate) documentation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue