diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-01-19 19:21:14 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-01-21 22:00:18 +1100 |
| commit | 39713b829535b40aff2b7f368839d07ea7c2bf11 (patch) | |
| tree | 897cd7f2eb52770a2dd4d4c69efc47e1ecc7b4f7 /src/libextra | |
| parent | 39012288118146331add60f2b1c90b07b6a6c51b (diff) | |
| download | rust-39713b829535b40aff2b7f368839d07ea7c2bf11.tar.gz rust-39713b829535b40aff2b7f368839d07ea7c2bf11.zip | |
Remove unnecessary parentheses.
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/ebml.rs | 16 | ||||
| -rw-r--r-- | src/libextra/enum_set.rs | 2 | ||||
| -rw-r--r-- | src/libextra/getopts.rs | 4 | ||||
| -rw-r--r-- | src/libextra/json.rs | 4 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 4 | ||||
| -rw-r--r-- | src/libextra/terminfo/parser/compiled.rs | 2 | ||||
| -rw-r--r-- | src/libextra/time.rs | 6 | ||||
| -rw-r--r-- | src/libextra/uuid.rs | 8 |
8 files changed, 23 insertions, 23 deletions
diff --git a/src/libextra/ebml.rs b/src/libextra/ebml.rs index 84d4584751d..f7481599bac 100644 --- a/src/libextra/ebml.rs +++ b/src/libextra/ebml.rs @@ -1025,7 +1025,7 @@ mod bench { pub fn vuint_at_A_aligned(bh: &mut BenchHarness) { use std::vec; let data = vec::from_fn(4*100, |i| { - match (i % 2) { + match i % 2 { 0 => 0x80u8, _ => i as u8, } @@ -1033,7 +1033,7 @@ mod bench { let mut sum = 0u; bh.iter(|| { let mut i = 0; - while (i < data.len()) { + while i < data.len() { sum += reader::vuint_at(data, i).val; i += 4; } @@ -1044,7 +1044,7 @@ mod bench { pub fn vuint_at_A_unaligned(bh: &mut BenchHarness) { use std::vec; let data = vec::from_fn(4*100+1, |i| { - match (i % 2) { + match i % 2 { 1 => 0x80u8, _ => i as u8 } @@ -1052,7 +1052,7 @@ mod bench { let mut sum = 0u; bh.iter(|| { let mut i = 1; - while (i < data.len()) { + while i < data.len() { sum += reader::vuint_at(data, i).val; i += 4; } @@ -1063,7 +1063,7 @@ mod bench { pub fn vuint_at_D_aligned(bh: &mut BenchHarness) { use std::vec; let data = vec::from_fn(4*100, |i| { - match (i % 4) { + match i % 4 { 0 => 0x10u8, 3 => i as u8, _ => 0u8 @@ -1072,7 +1072,7 @@ mod bench { let mut sum = 0u; bh.iter(|| { let mut i = 0; - while (i < data.len()) { + while i < data.len() { sum += reader::vuint_at(data, i).val; i += 4; } @@ -1083,7 +1083,7 @@ mod bench { pub fn vuint_at_D_unaligned(bh: &mut BenchHarness) { use std::vec; let data = vec::from_fn(4*100+1, |i| { - match (i % 4) { + match i % 4 { 1 => 0x10u8, 0 => i as u8, _ => 0u8 @@ -1092,7 +1092,7 @@ mod bench { let mut sum = 0u; bh.iter(|| { let mut i = 1; - while (i < data.len()) { + while i < data.len() { sum += reader::vuint_at(data, i).val; i += 4; } diff --git a/src/libextra/enum_set.rs b/src/libextra/enum_set.rs index f12da3080aa..a17e807b6ee 100644 --- a/src/libextra/enum_set.rs +++ b/src/libextra/enum_set.rs @@ -114,7 +114,7 @@ impl<E:CLike> Items<E> { impl<E:CLike> Iterator<E> for Items<E> { fn next(&mut self) -> Option<E> { - if (self.bits == 0) { + if self.bits == 0 { return None; } diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index bf86bf526a2..10d28eaafb0 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -195,7 +195,7 @@ impl Matches { fn opt_val(&self, nm: &str) -> Option<Optval> { let vals = self.opt_vals(nm); - if (vals.is_empty()) { + if vals.is_empty() { None } else { Some(vals[0].clone()) @@ -797,7 +797,7 @@ pub mod groups { let slice: || = || { cont = it(ss.slice(slice_start, last_end)) }; // if the limit is larger than the string, lower it to save cycles - if (lim >= fake_i) { + if lim >= fake_i { lim = fake_i; } diff --git a/src/libextra/json.rs b/src/libextra/json.rs index cba4364d5b4..378e1e85339 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -929,7 +929,7 @@ impl<T : Iterator<char>> Parser<T> { return self.error(~"EOF while parsing string"); } - if (escape) { + if escape { match self.ch { '"' => res.push_char('"'), '\\' => res.push_char('\\'), @@ -1360,7 +1360,7 @@ impl serialize::Decoder for Decoder { /// Test if two json values are less than one another impl Ord for Json { fn lt(&self, other: &Json) -> bool { - match (*self) { + match *self { Number(f0) => { match *other { Number(f1) => f0 < f1, diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 8f491e836b8..178356ac261 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -561,9 +561,9 @@ impl ToPrimitive for BigUint { impl FromPrimitive for BigUint { #[inline] fn from_i64(n: i64) -> Option<BigUint> { - if (n > 0) { + if n > 0 { FromPrimitive::from_u64(n as u64) - } else if (n == 0) { + } else if n == 0 { Some(Zero::zero()) } else { None diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 76bae402d72..8d63021d51b 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -178,7 +178,7 @@ pub fn parse(file: &mut io::Reader, // Check magic number let magic = file.read_le_u16(); - if (magic != 0x011A) { + if magic != 0x011A { return Err(format!("invalid magic number: expected {:x} but found {:x}", 0x011A, magic as uint)); } diff --git a/src/libextra/time.rs b/src/libextra/time.rs index 222155d9ab3..9d7c71d6e6c 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -808,7 +808,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> { /// Formats the time according to the format string. pub fn strftime(format: &str, tm: &Tm) -> ~str { fn days_in_year(year: int) -> i32 { - if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) { + if (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)) { 366 /* Days in a leap year */ } else { 365 /* Days in a non-leap year */ @@ -838,14 +838,14 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str { let mut year: int = tm.tm_year as int + 1900; let mut days: int = iso_week_days (tm.tm_yday, tm.tm_wday); - if (days < 0) { + if days < 0 { /* This ISO week belongs to the previous year. */ year -= 1; days = iso_week_days (tm.tm_yday + (days_in_year(year)), tm.tm_wday); } else { let d: int = iso_week_days (tm.tm_yday - (days_in_year(year)), tm.tm_wday); - if (0 <= d) { + if 0 <= d { /* This ISO week belongs to the next year. */ year += 1; days = d; diff --git a/src/libextra/uuid.rs b/src/libextra/uuid.rs index 02930dc9c4c..3465deb5a59 100644 --- a/src/libextra/uuid.rs +++ b/src/libextra/uuid.rs @@ -614,16 +614,16 @@ mod test { // Test error reporting let e = Uuid::parse_string("67e5504410b1426f9247bb680e5fe0c").unwrap_err(); - assert!(match(e){ ErrorInvalidLength(n) => n==31, _ => false }); + assert!(match e { ErrorInvalidLength(n) => n==31, _ => false }); let e = Uuid::parse_string("67e550X410b1426f9247bb680e5fe0cd").unwrap_err(); - assert!(match(e){ ErrorInvalidCharacter(c, n) => c=='X' && n==6, _ => false }); + assert!(match e { ErrorInvalidCharacter(c, n) => c=='X' && n==6, _ => false }); let e = Uuid::parse_string("67e550-4105b1426f9247bb680e5fe0c").unwrap_err(); - assert!(match(e){ ErrorInvalidGroups(n) => n==2, _ => false }); + assert!(match e { ErrorInvalidGroups(n) => n==2, _ => false }); let e = Uuid::parse_string("F9168C5E-CEB2-4faa-B6BF1-02BF39FA1E4").unwrap_err(); - assert!(match(e){ ErrorInvalidGroupLength(g, n, e) => g==3 && n==5 && e==4, _ => false }); + assert!(match e { ErrorInvalidGroupLength(g, n, e) => g==3 && n==5 && e==4, _ => false }); } #[test] |
