]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary parentheses.
authorHuon Wilson <dbau.pp+github@gmail.com>
Sun, 19 Jan 2014 08:21:14 +0000 (19:21 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Tue, 21 Jan 2014 11:00:18 +0000 (22:00 +1100)
47 files changed:
src/compiletest/compiletest.rs
src/compiletest/runtest.rs
src/libextra/ebml.rs
src/libextra/enum_set.rs
src/libextra/getopts.rs
src/libextra/json.rs
src/libextra/num/bigint.rs
src/libextra/terminfo/parser/compiled.rs
src/libextra/time.rs
src/libextra/uuid.rs
src/libgreen/sched.rs
src/libnative/io/file.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/check_match.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/variance.rs
src/librustpkg/parse_args.rs
src/librustpkg/testsuite/pass/src/install-paths/bench.rs
src/libstd/hash.rs
src/libstd/io/extensions.rs
src/libstd/option.rs
src/libstd/os.rs
src/libstd/ptr.rs
src/libstd/str.rs
src/libstd/sync/mpmc_bounded_queue.rs
src/libstd/task.rs
src/libstd/trie.rs
src/libsyntax/ast.rs
src/libsyntax/ast_util.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/parse/lexer.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/parser_testing.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-threadring.rs
src/test/bench/sudoku.rs

index 502f71ce837463cd8c5b8d5dd72b5a8151ded63a..cbe4c52b47ebb28f8bfb85163762b66bbf0b48a6 100644 (file)
@@ -140,14 +140,9 @@ fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
         adb_test_dir:
             opt_str2(matches.opt_str("adb-test-dir")).to_str(),
         adb_device_status:
-            if (opt_str2(matches.opt_str("target")) ==
-                ~"arm-linux-androideabi") {
-                if (opt_str2(matches.opt_str("adb-test-dir")) !=
-                    ~"(none)" &&
-                    opt_str2(matches.opt_str("adb-test-dir")) !=
-                    ~"") { true }
-                else { false }
-            } else { false },
+            "arm-linux-androideabi" == opt_str2(matches.opt_str("target")) &&
+            "(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
+            !opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
         test_shard: test::opt_shard(matches.opt_str("test-shard")),
         verbose: matches.opt_present("verbose")
     }
index d0a0603081840335acd06d63cb0f668163bdff18..e06f4e32631203da3bb6dc95b303af8c22cdd2df 100644 (file)
@@ -532,9 +532,9 @@ fn prefix_matches( line : &str, prefix : &str ) -> bool {
             if !found_flags[i] {
                 debug!("prefix={} ee.kind={} ee.msg={} line={}",
                        prefixes[i], ee.kind, ee.msg, line);
-                if (prefix_matches(line, prefixes[i]) &&
+                if prefix_matches(line, prefixes[i]) &&
                     line.contains(ee.kind) &&
-                    line.contains(ee.msg)) {
+                    line.contains(ee.msg) {
                     found_flags[i] = true;
                     was_expected = true;
                     break;
index 84d4584751d013bf91a047f1e6a188db898e7a69..f7481599bacfb42795fc7cad8b406fb3142b5ce4 100644 (file)
@@ -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 @@ pub fn vuint_at_A_aligned(bh: &mut BenchHarness) {
         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 @@ pub fn vuint_at_A_aligned(bh: &mut BenchHarness) {
     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 @@ pub fn vuint_at_A_unaligned(bh: &mut BenchHarness) {
         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 @@ pub fn vuint_at_A_unaligned(bh: &mut BenchHarness) {
     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 @@ pub fn vuint_at_D_aligned(bh: &mut BenchHarness) {
         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 @@ pub fn vuint_at_D_aligned(bh: &mut BenchHarness) {
     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 @@ pub fn vuint_at_D_unaligned(bh: &mut BenchHarness) {
         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;
             }
index f12da3080aa809c8968530afd2f507c656b66497..a17e807b6eefeaf4e02554a4d54d1d65d22b04ad 100644 (file)
@@ -114,7 +114,7 @@ fn new(bits: uint) -> 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;
         }
 
index bf86bf526a29de3da6d404811faca4ad188a0f6c..10d28eaafb0cdd85dc73759e5ade06c5cb7beea3 100644 (file)
@@ -195,7 +195,7 @@ fn opt_vals(&self, nm: &str) -> ~[Optval] {
 
     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 @@ enum LengthLimit {
         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;
         }
 
index cba4364d5b400b81c23f64e05a33fe97602f8eba..378e1e85339ffdf06e81c7104ef03555fe0f69ee 100644 (file)
@@ -929,7 +929,7 @@ fn parse_str(&mut self) -> Result<~str, Error> {
                 return self.error(~"EOF while parsing string");
             }
 
-            if (escape) {
+            if escape {
                 match self.ch {
                   '"' => res.push_char('"'),
                   '\\' => res.push_char('\\'),
@@ -1360,7 +1360,7 @@ fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Decoder| -> T)
 /// 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,
index 8f491e836b8f2a0e9a6463751f674f5157de3d51..178356ac2613283906bb80cede7fc15bb3cdaa2b 100644 (file)
@@ -561,9 +561,9 @@ fn to_u64(&self) -> Option<u64> {
 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
index 76bae402d72e0139a1f64bb84e8d2e81402e8c86..8d63021d51b8832e6f6eacde513c002ad90924b7 100644 (file)
@@ -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));
     }
index 222155d9ab356096ce3f7460fc92d04f22b25891..9d7c71d6e6cf24d230408853addceb20993a063d 100644 (file)
@@ -808,7 +808,7 @@ fn parse_type(s: &str, pos: uint, ch: char, tm: &mut Tm)
 /// 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 @@ fn iso_week(ch:char, 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;
index 02930dc9c4c6413530fcafac52679f573fc50ae7..3465deb5a59185093e317d121b7daf543dd90fdb 100644 (file)
@@ -614,16 +614,16 @@ fn test_parse_uuid_v4() {
 
         // 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]
index 1ae4d07af18ec9d5ba4782301834f8220906298c..3554d435e556ca58ecad078fec18c5e5e9b85fba 100644 (file)
@@ -1323,7 +1323,7 @@ fn thread_ring() {
         fn roundtrip(id: int, n_tasks: int,
                      p: &Port<(int, Chan<()>)>,
                      ch: &Chan<(int, Chan<()>)>) {
-            while (true) {
+            loop {
                 match p.recv() {
                     (1, end_chan) => {
                         debug!("{}\n", id);
index 9e1bc97708298c521de7f5a0bfd683e03eaea298..af6ed51729ef119ede900e9d1393f9e159b8b60c 100644 (file)
@@ -508,11 +508,11 @@ unsafe fn get_list(p: &CString) -> IoResult<~[Path]> {
 
             let dir_ptr = p.with_ref(|buf| opendir(buf));
 
-            if (dir_ptr as uint != 0) {
+            if dir_ptr as uint != 0 {
                 let mut paths = ~[];
                 debug!("os::list_dir -- opendir() SUCCESS");
                 let mut entry_ptr = readdir(dir_ptr);
-                while (entry_ptr as uint != 0) {
+                while entry_ptr as uint != 0 {
                     let cstr = CString::new(rust_list_dir_val(entry_ptr), false);
                     paths.push(Path::new(cstr));
                     entry_ptr = readdir(dir_ptr);
index c58a02b6b20a892b4586b8f9e5aafa08b454d0be..9bf3e2ca43e806cf54f605910fab9a25b7875558 100644 (file)
@@ -1956,7 +1956,7 @@ fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, crate: &Crate)
 
     ecx.stats.total_bytes.set(ebml_w.writer.tell());
 
-    if (tcx.sess.meta_stats()) {
+    if tcx.sess.meta_stats() {
         for e in ebml_w.writer.get_ref().iter() {
             if *e == 0 {
                 ecx.stats.zero_bytes.set(ecx.stats.zero_bytes.get() + 1);
index 598f62ce03ff927aa9426eb8cfcb72c779a1142c..38376de4346df0bc1d0a0c15e43f2f8039dc66e8 100644 (file)
@@ -175,7 +175,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
         useful(ty, ref ctor) => {
             match ty::get(ty).sty {
                 ty::ty_bool => {
-                    match (*ctor) {
+                    match *ctor {
                         val(const_bool(true)) => Some(@"true"),
                         val(const_bool(false)) => Some(@"false"),
                         _ => None
index e42f4433653d312d222435005043b5e838491dba..7b094591b1a39d92f8b8c050e6dbb812641f0588 100644 (file)
@@ -1039,7 +1039,7 @@ fn add_child(&mut self,
                 let mut duplicate_type = NoError;
                 let ns = match duplicate_checking_mode {
                     ForbidDuplicateModules => {
-                        if (child.get_module_if_available().is_some()) {
+                        if child.get_module_if_available().is_some() {
                             duplicate_type = ModuleError;
                         }
                         Some(TypeNS)
@@ -1074,7 +1074,7 @@ fn add_child(&mut self,
                     }
                     OverwriteDuplicates => None
                 };
-                if (duplicate_type != NoError) {
+                if duplicate_type != NoError {
                     // Return an error here by looking up the namespace that
                     // had the duplicate.
                     let ns = ns.unwrap();
index 91dcae2d1d3084659e8e7fdd2a627366a23e187f..7b194690b2f23efbbc85c2fc0aeba98512f79197 100644 (file)
@@ -666,7 +666,7 @@ pub fn trans_field_ptr(bcx: &Block, r: &Repr, val: ValueRef, discr: Disr,
         }
         NullablePointer{ nonnull: ref nonnull, nullfields: ref nullfields,
                          nndiscr, .. } => {
-            if (discr == nndiscr) {
+            if discr == nndiscr {
                 struct_field_ptr(bcx, nonnull, val, ix, false)
             } else {
                 // The unit-like case might have a nonzero number of unit-like fields.
@@ -783,7 +783,7 @@ fn build_const_struct(ccx: &CrateContext, st: &Struct, vals: &[ValueRef])
             /*bad*/as u64;
         let target_offset = roundup(offset, type_align);
         offset = roundup(offset, val_align);
-        if (offset != target_offset) {
+        if offset != target_offset {
             cfields.push(padding(target_offset - offset));
             offset = target_offset;
         }
index de7478aa0aeb9f3fc47508cc88e0242a50be75e3..6aa35096792ab7c9017a8d6be340692610a6d1ba 100644 (file)
@@ -2156,7 +2156,7 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::NodeId) -> ValueRef {
                         _ => fail!("get_item_val: weird result in table")
                     };
 
-                    match (attr::first_attr_value_str_by_name(i.attrs, "link_section")) {
+                    match attr::first_attr_value_str_by_name(i.attrs, "link_section") {
                         Some(sect) => unsafe {
                             sect.with_c_str(|buf| {
                                 llvm::LLVMSetSection(v, buf);
index 1642d333a9a6097d4b189e0e7e820255477544a7..5a5a028c38000f29870a06a300d75e058b6b6152 100644 (file)
@@ -686,7 +686,7 @@ pub fn iter_vec_raw<'r,
     let fcx = bcx.fcx;
 
     let vt = vec_types(bcx, vec_ty);
-    if (vt.llunit_alloc_size == 0) {
+    if vt.llunit_alloc_size == 0 {
         // Special-case vectors with elements of size 0  so they don't go out of bounds (#9890)
         iter_vec_loop(bcx, data_ptr, &vt, fill, f)
     } else {
@@ -740,4 +740,3 @@ pub fn iter_vec_unboxed<'r,
     let dataptr = get_dataptr(bcx, body_ptr);
     return iter_vec_raw(bcx, dataptr, vec_ty, fill, f);
 }
-
index ee1a34bfbb38231db9fc1b013282c3b3323ca993..31ac97965b95bab1dea0ab657a911dc1eeab03ba 100644 (file)
@@ -2883,7 +2883,7 @@ pub fn adjust_ty(cx: ctxt,
                 AutoDerefRef(ref adj) => {
                     let mut adjusted_ty = unadjusted_ty;
 
-                    if (!ty::type_is_error(adjusted_ty)) {
+                    if !ty::type_is_error(adjusted_ty) {
                         for i in range(0, adj.autoderefs) {
                             match ty::deref(adjusted_ty, true) {
                                 Some(mt) => { adjusted_ty = mt.ty; }
index c6e43bf968e9b764568f54593ab98f11fe30b228..b21f2c7463055b35da9ae09a30b668b4b451a467 100644 (file)
@@ -740,7 +740,7 @@ fn constrain_regions_in_type(
         }
     });
 
-    return (e == rcx.errors_reported);
+    return e == rcx.errors_reported;
 }
 
 pub mod guarantor {
@@ -1175,7 +1175,7 @@ fn apply_autoderefs(
         let mut ct = ct;
         let tcx = rcx.fcx.ccx.tcx;
 
-        if (ty::type_is_error(ct.ty)) {
+        if ty::type_is_error(ct.ty) {
             ct.cat.pointer = NotPointer;
             return ct;
         }
index 5dbcae7418bc6f2296e0358d5e75a4cc4f32a23a..8f85c185adbcce59a7210dba1e74b952ba798dd1 100644 (file)
@@ -599,7 +599,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                   (&ty::ty_box(..), ty::BoxTraitStore) |
                   (&ty::ty_uniq(..), ty::UniqTraitStore) |
                   (&ty::ty_rptr(..), ty::RegionTraitStore(..)) => {
-                    let typ = match (&ty::get(ty).sty) {
+                    let typ = match &ty::get(ty).sty {
                         &ty::ty_box(typ) | &ty::ty_uniq(typ) => typ,
                         &ty::ty_rptr(_, mt) => mt.ty,
                         _ => fail!("shouldn't get here"),
index 1db05f16875865ab5b21dfef00e72814bb1826b6..7740645030d221681eba8e18cf0d925bf869e40d 100644 (file)
@@ -889,8 +889,8 @@ fn write(&self) {
                 type_params: opt_vec::Empty,
                 region_params: opt_vec::Empty
             };
-            while (index < num_inferred &&
-                   inferred_infos[index].item_id == item_id) {
+            while index < num_inferred &&
+                  inferred_infos[index].item_id == item_id {
                 let info = &inferred_infos[index];
                 match info.kind {
                     SelfParam => {
@@ -999,4 +999,3 @@ fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance {
         (x, ty::Bivariant) | (ty::Bivariant, x) => x,
     }
 }
-
index 1051d475a8489b1c7a55a42484ae64fbe88f0280..9a9a9c5fccb48f731e7a57e930c59eef899e418f 100644 (file)
@@ -119,7 +119,7 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
     let mut args = matches.free.clone();
     args.shift();
 
-    if (args.len() < 1) {
+    if args.len() < 1 {
         usage::general();
         return Err(1);
     }
@@ -154,7 +154,7 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
     };
 
     let cmd_opt = args.iter().filter_map( |s| from_str(s.clone())).next();
-    let command = match(cmd_opt){
+    let command = match cmd_opt {
         None => {
             debug!("No legal command. Returning 0");
             usage::general();
@@ -194,4 +194,3 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
         sysroot: supplied_sysroot
     })
 }
-
index a886a7e0079d9b9730e1ca193151bed9539fafbe..62ee0ed88fdd98171e6d8089cbdf4ee3585682ea 100644 (file)
@@ -11,7 +11,7 @@
 #[bench]
 pub fn g() {
     let mut x = 0;
-    while(x < 1000) {
+    while x < 1000 {
         x += 1;
     }
 }
index d1b1273d5e0a446721e20972762ffc72fb13e2f3..1444f9b4129d8570082814bcf7820e1b87ae8447 100644 (file)
@@ -263,7 +263,7 @@ fn result_u64(&mut self) -> u64 {
         compress!(v0, v1, v2, v3);
         compress!(v0, v1, v2, v3);
 
-        return (v0 ^ v1 ^ v2 ^ v3);
+        return v0 ^ v1 ^ v2 ^ v3;
     }
 
     fn result_bytes(&mut self) -> ~[u8] {
index 511462f89f83db0ff69d5aed761eaba51395364f..e58fcc16182363dcdd8f6bc19f4280d0e7df861d 100644 (file)
@@ -518,7 +518,7 @@ macro_rules! u64_from_be_bytes_bench_impl(
             let mut sum = 0u64;
             bh.iter(|| {
                 let mut i = $start_index;
-                while (i < data.len()) {
+                while i < data.len() {
                     sum += u64_from_be_bytes(data, i, $size);
                     i += $stride;
                 }
index 621b1a3d1e2d7684d445bd3d2c3904101678e91b..53fa41f9cfdc88d373130ffe7bc4e2d7605824f5 100644 (file)
@@ -292,7 +292,7 @@ pub fn take(&mut self) -> Option<T> {
     #[inline(always)]
     pub fn filtered(self, f: |t: &T| -> bool) -> Option<T> {
         match self {
-            Some(x) => if(f(&x)) {Some(x)} else {None},
+            Some(x) => if f(&x) {Some(x)} else {None},
             None => None
         }
     }
@@ -605,7 +605,7 @@ fn test_option_while_some() {
         let mut i = 0;
         Some(10).while_some(|j| {
             i += 1;
-            if (j > 0) {
+            if j > 0 {
                 Some(j-1)
             } else {
                 None
index 4042e13a592d3f67667bd18f20a577165b81c968..36ce3e9312791b7910165cb1d3d1cf9c69a60341 100644 (file)
@@ -103,9 +103,9 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD)
                 let k = f(buf.as_mut_ptr(), TMPBUF_SZ as DWORD);
                 if k == (0 as DWORD) {
                     done = true;
-                } else if (k == n &&
-                           libc::GetLastError() ==
-                           libc::ERROR_INSUFFICIENT_BUFFER as DWORD) {
+                } else if k == n &&
+                          libc::GetLastError() ==
+                          libc::ERROR_INSUFFICIENT_BUFFER as DWORD {
                     n *= (2 as DWORD);
                 } else {
                     done = true;
@@ -159,7 +159,7 @@ unsafe fn get_env_pairs() -> ~[~str] {
                 FreeEnvironmentStringsA
             };
             let ch = GetEnvironmentStringsA();
-            if (ch as uint == 0) {
+            if ch as uint == 0 {
                 fail!("os::env() failure getting env string from OS: {}",
                        os::last_os_error());
             }
@@ -176,7 +176,7 @@ unsafe fn get_env_pairs() -> ~[~str] {
                 fn rust_env_pairs() -> **libc::c_char;
             }
             let environ = rust_env_pairs();
-            if (environ as uint == 0) {
+            if environ as uint == 0 {
                 fail!("os::env() failure getting env string from OS: {}",
                        os::last_os_error());
             }
index 9cf36adc36f23da64f00103d7be5af44c85f64e1..dcb6d2719d9077792b6fdc3dc66739eeea6ea6ee 100644 (file)
@@ -201,7 +201,7 @@ pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
 */
 pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
     debug!("array_each_with_len: before iterate");
-    if (arr as uint == 0) {
+    if arr as uint == 0 {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
     //let start_ptr = *arr;
@@ -222,7 +222,7 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
   Dragons be here.
 */
 pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
-    if (arr as uint == 0) {
+    if arr as uint == 0 {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
     let len = buf_len(arr);
index fdc9c11d93a3ae7fea6a27c08be5f150083f810d..7398960eeb7cf480d408d76fbedc6e9772fec298 100644 (file)
@@ -861,7 +861,7 @@ fn unsafe_get(xs: &[u8], i: uint) -> u8 {
 pub fn is_utf16(v: &[u16]) -> bool {
     let len = v.len();
     let mut i = 0u;
-    while (i < len) {
+    while i < len {
         let u = v[i];
 
         if  u <= 0xD7FF_u16 || u >= 0xE000_u16 {
@@ -887,7 +887,7 @@ pub fn is_utf16(v: &[u16]) -> bool {
 pub fn utf16_chars(v: &[u16], f: |char|) {
     let len = v.len();
     let mut i = 0u;
-    while (i < len && v[i] != 0u16) {
+    while i < len && v[i] != 0u16 {
         let u = v[i];
 
         if  u <= 0xD7FF_u16 || u >= 0xE000_u16 {
@@ -2326,7 +2326,7 @@ fn is_char_boundary(&self, index: uint) -> bool {
 
     #[inline]
     fn char_range_at(&self, i: uint) -> CharRange {
-        if (self[i] < 128u8) {
+        if self[i] < 128u8 {
             return CharRange {ch: self[i] as char, next: i + 1 };
         }
 
index bf02bf204a53d1f99bf941db812d22ed60616615..18be85152d715a772cad9652623e80b464351ccd 100644 (file)
@@ -101,7 +101,7 @@ fn push(&mut self, value: T) -> bool {
                 } else {
                     pos = enqueue_pos;
                 }
-            } else if (diff < 0) {
+            } else if diff < 0 {
                 return false
             } else {
                 pos = self.enqueue_pos.load(Relaxed);
index 900b6d49cc66c1326431bf3ded3be096c4f81ed0..8ed4b70c0a28aa8a97075293c2bf375a79b1da60 100644 (file)
@@ -481,7 +481,7 @@ fn test_spawn_sched() {
     fn f(i: int, ch: SharedChan<()>) {
         let ch = ch.clone();
         do spawn {
-            if (i == 0) {
+            if i == 0 {
                 ch.send(());
             } else {
                 f(i - 1, ch);
index 2c3fd18e587de7aa96d59dae410de3df80c2243f..ead9cec9943e5500f4be44114851c2bd07c33507 100644 (file)
@@ -839,7 +839,7 @@ fn test_bound() {
             let mut ub = map.upper_bound(i);
             let next_key = i - i % step + step;
             let next_pair = (next_key, &value);
-            if (i % step == 0) {
+            if i % step == 0 {
                 assert_eq!(lb.next(), Some((i, &value)));
             } else {
                 assert_eq!(lb.next(), Some(next_pair));
index 800172daf1500b7dfa39a6d1290a075b59c01335..03b7f1891a16c51f447b683e4e63124847dd0876 100644 (file)
@@ -46,7 +46,7 @@ pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
 
 impl Eq for Ident {
     fn eq(&self, other: &Ident) -> bool {
-        if (self.ctxt == other.ctxt) {
+        if self.ctxt == other.ctxt {
             self.name == other.name
         } else {
             // IF YOU SEE ONE OF THESE FAILS: it means that you're comparing
index 598e30957e4f2a409be619fabf1504b5eef66312..04a89a03852d0ea921deb354a355491b0164377a 100644 (file)
@@ -829,9 +829,9 @@ pub fn resolve_internal(id : Ident,
                             resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
                         let resolvedthis =
                             resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
-                        if ((resolvedthis == resolvedfrom)
+                        if (resolvedthis == resolvedfrom)
                             && (marksof(ctxt,resolvedthis,table)
-                                == marksof(subctxt,resolvedthis,table))) {
+                                == marksof(subctxt,resolvedthis,table)) {
                             toname
                         } else {
                             resolvedthis
@@ -878,7 +878,7 @@ pub fn marksof(ctxt: SyntaxContext, stopname: Name, table: &SCTable) -> ~[Mrk] {
             Rename(_,name,tl) => {
                 // see MTWT for details on the purpose of the stopname.
                 // short version: it prevents duplication of effort.
-                if (name == stopname) {
+                if name == stopname {
                     return result;
                 } else {
                     loopvar = tl;
@@ -903,7 +903,7 @@ pub fn mtwt_outer_mark(ctxt: SyntaxContext) -> Mrk {
 /// Push a name... unless it matches the one on top, in which
 /// case pop and discard (so two of the same marks cancel)
 pub fn xorPush(marks: &mut ~[Mrk], mark: Mrk) {
-    if ((marks.len() > 0) && (getLast(marks) == mark)) {
+    if (marks.len() > 0) && (getLast(marks) == mark) {
         marks.pop();
     } else {
         marks.push(mark);
@@ -927,7 +927,7 @@ pub fn path_name_eq(a : &ast::Path, b : &ast::Path) -> bool {
 
 // are two arrays of segments equal when compared unhygienically?
 pub fn segments_name_eq(a : &[ast::PathSegment], b : &[ast::PathSegment]) -> bool {
-    if (a.len() != b.len()) {
+    if a.len() != b.len() {
         false
     } else {
         for (idx,seg) in a.iter().enumerate() {
index 904ef91d635713cb68f7e5c7a26efeeca1f9e7d0..15146551370b20a92e7c1c9929bf45046ce85b0b 100644 (file)
@@ -387,7 +387,7 @@ fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
                 a = m;
             }
         }
-        if (a >= len) {
+        if a >= len {
             fail!("position {} does not resolve to a source location", pos.to_uint())
         }
 
index 0abb6d9a31357e7f8d4d4ab0d08eb7adaa223554..f547f32e21dbc61c65c8a820c6ffc03721caec75 100644 (file)
@@ -46,7 +46,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
                 // in this file.
                 // Token-tree macros:
                 MacInvocTT(ref pth, ref tts, ctxt) => {
-                    if (pth.segments.len() > 1u) {
+                    if pth.segments.len() > 1u {
                         fld.cx.span_err(
                             pth.span,
                             format!("expected macro name without module \
@@ -464,7 +464,7 @@ pub fn expand_stmt(s: &Stmt, fld: &mut MacroExpander) -> SmallVector<@Stmt> {
         }
         _ => return expand_non_macro_stmt(s, fld)
     };
-    if (pth.segments.len() > 1u) {
+    if pth.segments.len() > 1u {
         fld.cx.span_err(pth.span, "expected macro name without module separators");
         return SmallVector::zero();
     }
index 1080291179b550e6bbab1596c0878f95dd6e9541..dc721f15c3b85ef99c15264091716423a1d0ac38 100644 (file)
@@ -333,7 +333,7 @@ pub fn parse(sess: @ParseSess,
                   MatchTok(ref t) => {
                     let mut ei_t = ei.clone();
                     //if (token_name_eq(t,&tok)) {
-                    if (token::mtwt_token_eq(t,&tok)) {
+                    if token::mtwt_token_eq(t,&tok) {
                         ei_t.idx += 1;
                         next_eis.push(ei_t);
                     }
@@ -370,12 +370,12 @@ pub fn parse(sess: @ParseSess,
                     "local ambiguity: multiple parsing options: \
                      built-in NTs {} or {} other options.",
                     nts, next_eis.len()));
-            } else if (bb_eis.len() == 0u && next_eis.len() == 0u) {
+            } else if bb_eis.len() == 0u && next_eis.len() == 0u {
                 return Failure(sp, format!("no rules expected the token `{}`",
                             to_str(get_ident_interner(), &tok)));
-            } else if (next_eis.len() > 0u) {
+            } else if next_eis.len() > 0u {
                 /* Now process the next token */
-                while(next_eis.len() > 0u) {
+                while next_eis.len() > 0u {
                     cur_eis.push(next_eis.pop());
                 }
                 rdr.next_token();
index cb7d54d73052974f3354290f9df10ba8db08e38a..facbee135ed9fafe44a60962d2b6b15dae3d6cfe 100644 (file)
@@ -135,7 +135,7 @@ fn generic_extension(cx: &ExtCtxt,
                 let rhs = match *rhses[i] {
                     // okay, what's your transcriber?
                     MatchedNonterminal(NtTT(tt)) => {
-                        match (*tt) {
+                        match *tt {
                             // cut off delimiters; don't parse 'em
                             TTDelim(ref tts) => {
                                 (*tts).slice(1u,(*tts).len()-1u).to_owned()
index 885cfbcbdbef5506fe1098a0186fdaedd609f4d5..f753861892ffc359f16822e023d26bf54589817f 100644 (file)
@@ -198,7 +198,7 @@ fn fatal_span_verbose(rdr: @StringReader,
 // EFFECT: advance peek_tok and peek_span to refer to the next token.
 // EFFECT: update the interner, maybe.
 fn string_advance_token(r: @StringReader) {
-    match (consume_whitespace_and_comments(r)) {
+    match consume_whitespace_and_comments(r) {
         Some(comment) => {
             r.peek_span.set(comment.sp);
             r.peek_tok.set(comment.tok);
index e79c845b24d4868ea2595384fb70673bb686e788..3a5e737e026ed59c0ac3a8269695eeeb6fbbe850 100644 (file)
@@ -3393,7 +3393,7 @@ fn parse_block_tail_(&mut self, lo: BytePos, s: BlockCheckMode,
 
         let mut attributes_box = attrs_remaining;
 
-        while (self.token != token::RBRACE) {
+        while self.token != token::RBRACE {
             // parsing items even when they're not allowed lets us give
             // better error messages and recover more gracefully.
             attributes_box.push_all(self.parse_outer_attributes());
@@ -4373,7 +4373,7 @@ fn parse_foreign_mod_items(&mut self,
             items: _,
             foreign_items: foreign_items
         } = self.parse_foreign_items(first_item_attrs, true);
-        if (! attrs_remaining.is_empty()) {
+        if ! attrs_remaining.is_empty() {
             self.span_err(self.last_span,
                           "expected item after attributes");
         }
@@ -4553,7 +4553,7 @@ fn parse_enum_def(&mut self, _generics: &ast::Generics) -> EnumDef {
             if !self.eat(&token::COMMA) { break; }
         }
         self.expect(&token::RBRACE);
-        if (have_disr && !all_nullary) {
+        if have_disr && !all_nullary {
             self.fatal("discriminator values can only be used with a c-like \
                         enum");
         }
index 42313e642838b83338a5d0ffb6fa53977dd1ff20..56681ef2def002d2abdc1b200f64965443d592fe 100644 (file)
@@ -218,7 +218,7 @@ pub fn to_str(input: @IdentInterner, t: &Token) -> ~str {
             &NtAttr(e) => ::print::pprust::attribute_to_str(e, input),
             _ => {
                 ~"an interpolated " +
-                    match (*nt) {
+                    match *nt {
                         NtItem(..) => ~"item",
                         NtBlock(..) => ~"block",
                         NtStmt(..) => ~"statement",
index a6fceb086c9192a88d5e5b987fd4bff2e8ca7d2f..82aa178e62b240f2620b684909e02f77fa805aeb 100644 (file)
@@ -774,7 +774,7 @@ pub fn print_tt(s: &mut State, tt: &ast::TokenTree) {
         word(&mut s.s, "$(");
         for tt_elt in (*tts).iter() { print_tt(s, tt_elt); }
         word(&mut s.s, ")");
-        match (*sep) {
+        match *sep {
           Some(ref tk) => word(&mut s.s, parse::token::to_str(s.intr, tk)),
           None => ()
         }
index 5153ddf1c7d171b22e887efe6eec7591ebc42787..dd3ae168149eba7014e50acfe7df8c599aff0c8a 100644 (file)
@@ -140,7 +140,7 @@ pub fn matches_codepattern(a : &str, b : &str) -> bool {
 fn scan_for_non_ws_or_end(a : &str, idx: uint) -> uint {
     let mut i = idx;
     let len = a.len();
-    while ((i < len) && (is_whitespace(a.char_at(i)))) {
+    while (i < len) && (is_whitespace(a.char_at(i))) {
         i += 1;
     }
     i
index 8f8485b5801ca0b502b015c9d42fa13e3692039d..2a5f7f0b87e98285c95444a62ea34337226ad2ed 100644 (file)
@@ -34,7 +34,7 @@ struct CreatureInfo {
 }
 
 fn show_color(cc: color) -> ~str {
-    match (cc) {
+    match cc {
         Red    => {~"red"}
         Yellow => {~"yellow"}
         Blue   => {~"blue"}
@@ -51,7 +51,7 @@ fn show_color_list(set: ~[color]) -> ~str {
 }
 
 fn show_digit(nn: uint) -> ~str {
-    match (nn) {
+    match nn {
         0 => {~"zero"}
         1 => {~"one"}
         2 => {~"two"}
index 6293b6ce8669ba365cf19df091908fa00933064c..862b047db22f464c81b219aa81e39a81d9007019 100644 (file)
@@ -37,7 +37,7 @@ fn start(n_tasks: int, token: int) {
 }
 
 fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
-    while (true) {
+    loop {
         match p.recv() {
           1 => {
             println!("{}\n", id);
index 4980691512d05514afb9a27216d98942280398f7..f0c183214ee54ca121191b23f7489fc2acea1df8 100644 (file)
@@ -110,7 +110,7 @@ pub fn solve(&mut self) {
 
         let mut ptr = 0u;
         let end = work.len();
-        while (ptr < end) {
+        while ptr < end {
             let (row, col) = work[ptr];
             // is there another color to try?
             if self.next_color(row, col, self.grid[row][col] + (1 as u8)) {