Skip to content

Instantly share code, notes, and snippets.

@nagisa
Last active October 17, 2015 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nagisa/7b4b2669445f2601ffd7 to your computer and use it in GitHub Desktop.
Save nagisa/7b4b2669445f2601ffd7 to your computer and use it in GitHub Desktop.
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index afd399b..1665723 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -1266,13 +1266,13 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return Ordering::Equal,
- (None, _ ) => return Ordering::Less,
- (_ , None) => return Ordering::Greater,
+ return match (self.next(), other.next()) {
+ (None, None) => Ordering::Equal,
+ (None, _ ) => Ordering::Less,
+ (_ , None) => Ordering::Greater,
(Some(x), Some(y)) => match x.cmp(&y) {
- Ordering::Equal => (),
- non_eq => return non_eq,
+ Ordering::Equal => continue,
+ non_eq => non_eq,
},
}
}
@@ -1289,13 +1289,13 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return Some(Ordering::Equal),
- (None, _ ) => return Some(Ordering::Less),
- (_ , None) => return Some(Ordering::Greater),
+ return match (self.next(), other.next()) {
+ (None, None) => Some(Ordering::Equal),
+ (None, _ ) => Some(Ordering::Less),
+ (_ , None) => Some(Ordering::Greater),
(Some(x), Some(y)) => match x.partial_cmp(&y) {
- Some(Ordering::Equal) => (),
- non_eq => return non_eq,
+ Some(Ordering::Equal) => continue,
+ non_eq => non_eq,
},
}
}
@@ -1312,10 +1312,10 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return true,
- (None, _) | (_, None) => return false,
- (Some(x), Some(y)) => if x != y { return false },
+ return match (self.next(), other.next()) {
+ (None, None) => true,
+ (None, _) | (_, None) => false,
+ (Some(x), Some(y)) => x == y,
}
}
}
@@ -1331,10 +1331,10 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return false,
- (None, _) | (_, None) => return true,
- (Some(x), Some(y)) => if x.ne(&y) { return true },
+ return match (self.next(), other.next()) {
+ (None, None) => false,
+ (None, _) | (_, None) => true,
+ (Some(x), Some(y)) => x.ne(&y),
}
}
}
@@ -1350,18 +1350,16 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return false,
- (None, _ ) => return true,
- (_ , None) => return false,
- (Some(x), Some(y)) => {
- match x.partial_cmp(&y) {
- Some(Ordering::Less) => return true,
- Some(Ordering::Equal) => {}
- Some(Ordering::Greater) => return false,
- None => return false,
- }
- },
+ return match (self.next(), other.next()) {
+ (None, None) => false,
+ (None, _ ) => true,
+ (_ , None) => false,
+ (Some(x), Some(y)) => match x.partial_cmp(&y) {
+ Some(Ordering::Less) => true,
+ Some(Ordering::Equal) => continue,
+ Some(Ordering::Greater) => false,
+ None => false,
+ }
}
}
}
@@ -1377,18 +1375,16 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return true,
- (None, _ ) => return true,
- (_ , None) => return false,
- (Some(x), Some(y)) => {
- match x.partial_cmp(&y) {
- Some(Ordering::Less) => return true,
- Some(Ordering::Equal) => {}
- Some(Ordering::Greater) => return false,
- None => return false,
- }
- },
+ return match (self.next(), other.next()) {
+ (None, None) => true,
+ (None, _ ) => true,
+ (_ , None) => false,
+ (Some(x), Some(y)) => match x.partial_cmp(&y) {
+ Some(Ordering::Less) => true,
+ Some(Ordering::Equal) => continue,
+ Some(Ordering::Greater) => false,
+ None => false,
+ }
}
}
}
@@ -1404,17 +1400,15 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return false,
- (None, _ ) => return false,
- (_ , None) => return true,
- (Some(x), Some(y)) => {
- match x.partial_cmp(&y) {
- Some(Ordering::Less) => return false,
- Some(Ordering::Equal) => {}
- Some(Ordering::Greater) => return true,
- None => return false,
- }
+ return match (self.next(), other.next()) {
+ (None, None) => false,
+ (None, _ ) => false,
+ (_ , None) => true,
+ (Some(x), Some(y)) => match x.partial_cmp(&y) {
+ Some(Ordering::Less) => false,
+ Some(Ordering::Equal) => continue,
+ Some(Ordering::Greater) => true,
+ None => false,
}
}
}
@@ -1431,18 +1425,16 @@ pub trait Iterator {
let mut other = other.into_iter();
loop {
- match (self.next(), other.next()) {
- (None, None) => return true,
- (None, _ ) => return false,
- (_ , None) => return true,
- (Some(x), Some(y)) => {
- match x.partial_cmp(&y) {
- Some(Ordering::Less) => return false,
- Some(Ordering::Equal) => {}
- Some(Ordering::Greater) => return true,
- None => return false,
- }
- },
+ return match (self.next(), other.next()) {
+ (None, None) => true,
+ (None, _ ) => false,
+ (_ , None) => true,
+ (Some(x), Some(y)) => match x.partial_cmp(&y) {
+ Some(Ordering::Less) => false,
+ Some(Ordering::Equal) => continue,
+ Some(Ordering::Greater) => true,
+ None => false,
+ }
}
}
}
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
src/libcore/num/mod.rs:46:9: 46:17 error: circular modules: src/libcore/num/mod.rs -> src/libcore/num/wrapping.rs
src/libcore/num/mod.rs:46 pub mod wrapping;
^~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment