diff options
Diffstat (limited to 'src/libstd/old_path/posix.rs')
| -rw-r--r-- | src/libstd/old_path/posix.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstd/old_path/posix.rs b/src/libstd/old_path/posix.rs index 0a184a01a1d..15eee9e4a0c 100644 --- a/src/libstd/old_path/posix.rs +++ b/src/libstd/old_path/posix.rs @@ -100,12 +100,21 @@ impl FromStr for Path { #[derive(Debug, Clone, PartialEq, Copy)] pub struct ParsePathError; +#[cfg(stage0)] impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for Path { #[inline] fn hash(&self, state: &mut S) { self.repr.hash(state) } } +#[cfg(not(stage0))] +#[stable(feature = "rust1", since = "1.0.0")] +impl hash::Hash for Path { + #[inline] + fn hash<H: hash::Hasher>(&self, state: &mut H) { + self.repr.hash(state) + } +} impl BytesContainer for Path { #[inline] @@ -1172,7 +1181,7 @@ mod tests { let exp: &[&[u8]] = &[$($exp),*]; assert_eq!(comps, exp); let comps = path.components().rev().collect::<Vec<&[u8]>>(); - let exp = exp.iter().rev().map(|&x|x).collect::<Vec<&[u8]>>(); + let exp = exp.iter().rev().cloned().collect::<Vec<&[u8]>>(); assert_eq!(comps, exp) } ) @@ -1204,7 +1213,7 @@ mod tests { let exp: &[Option<&str>] = &$exp; assert_eq!(comps, exp); let comps = path.str_components().rev().collect::<Vec<Option<&str>>>(); - let exp = exp.iter().rev().map(|&x|x).collect::<Vec<Option<&str>>>(); + let exp = exp.iter().rev().cloned().collect::<Vec<Option<&str>>>(); assert_eq!(comps, exp); } ) |
