diff options
| author | Steven Fackler <sfackler@gmail.com> | 2015-08-23 21:59:07 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2015-08-26 23:23:57 -0700 |
| commit | 651c42f11f6870dd2c23a1b33fed9ddefd043b76 (patch) | |
| tree | 80884384f083c5f4118068944d3168bf86ae0a0b /src/libstd | |
| parent | 63ba780fd7ab506bfd0f92d34a39172b412cfbe1 (diff) | |
| download | rust-651c42f11f6870dd2c23a1b33fed9ddefd043b76.tar.gz rust-651c42f11f6870dd2c23a1b33fed9ddefd043b76.zip | |
Make iter::order functions into methods on Iterator
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 71aed040871..3ee4ce80bd5 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -882,7 +882,7 @@ impl<'a> DoubleEndedIterator for Components<'a> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> cmp::PartialEq for Components<'a> { fn eq(&self, other: &Components<'a>) -> bool { - iter::order::eq(self.clone(), other.clone()) + Iterator::eq(self.clone(), other.clone()) } } @@ -892,14 +892,14 @@ impl<'a> cmp::Eq for Components<'a> {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a> cmp::PartialOrd for Components<'a> { fn partial_cmp(&self, other: &Components<'a>) -> Option<cmp::Ordering> { - iter::order::partial_cmp(self.clone(), other.clone()) + Iterator::partial_cmp(self.clone(), other.clone()) } } #[stable(feature = "rust1", since = "1.0.0")] impl<'a> cmp::Ord for Components<'a> { fn cmp(&self, other: &Components<'a>) -> cmp::Ordering { - iter::order::cmp(self.clone(), other.clone()) + Iterator::cmp(self.clone(), other.clone()) } } @@ -1162,14 +1162,14 @@ impl cmp::Eq for PathBuf {} #[stable(feature = "rust1", since = "1.0.0")] impl cmp::PartialOrd for PathBuf { fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> { - self.components().partial_cmp(&other.components()) + self.components().partial_cmp(other.components()) } } #[stable(feature = "rust1", since = "1.0.0")] impl cmp::Ord for PathBuf { fn cmp(&self, other: &PathBuf) -> cmp::Ordering { - self.components().cmp(&other.components()) + self.components().cmp(other.components()) } } @@ -1691,7 +1691,7 @@ impl<'a> fmt::Display for Display<'a> { #[stable(feature = "rust1", since = "1.0.0")] impl cmp::PartialEq for Path { fn eq(&self, other: &Path) -> bool { - iter::order::eq(self.components(), other.components()) + self.components().eq(other.components()) } } @@ -1701,14 +1701,14 @@ impl cmp::Eq for Path {} #[stable(feature = "rust1", since = "1.0.0")] impl cmp::PartialOrd for Path { fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> { - self.components().partial_cmp(&other.components()) + self.components().partial_cmp(other.components()) } } #[stable(feature = "rust1", since = "1.0.0")] impl cmp::Ord for Path { fn cmp(&self, other: &Path) -> cmp::Ordering { - self.components().cmp(&other.components()) + self.components().cmp(other.components()) } } |
