Prefix
can be case-insensitive, delegate to its Hash impl instead of trying to hash the raw bytes
This should have 0 performance overhead on unix since Prefix is always None.
This commit is contained in:
parent
a6e0aa20d9
commit
c1ea7bdc87
@ -2892,6 +2892,14 @@ impl cmp::PartialEq for Path {
|
|||||||
impl Hash for Path {
|
impl Hash for Path {
|
||||||
fn hash<H: Hasher>(&self, h: &mut H) {
|
fn hash<H: Hasher>(&self, h: &mut H) {
|
||||||
let bytes = self.as_u8_slice();
|
let bytes = self.as_u8_slice();
|
||||||
|
let prefix_len = match parse_prefix(&self.inner) {
|
||||||
|
Some(prefix) => {
|
||||||
|
prefix.hash(h);
|
||||||
|
prefix.len()
|
||||||
|
}
|
||||||
|
None => 0,
|
||||||
|
};
|
||||||
|
let bytes = &bytes[prefix_len..];
|
||||||
|
|
||||||
let mut component_start = 0;
|
let mut component_start = 0;
|
||||||
let mut bytes_hashed = 0;
|
let mut bytes_hashed = 0;
|
||||||
|
@ -11,6 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
|
|||||||
b == b'/'
|
b == b'/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
|
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user