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/libsyntax | |
| parent | 39012288118146331add60f2b1c90b07b6a6c51b (diff) | |
| download | rust-39713b829535b40aff2b7f368839d07ea7c2bf11.tar.gz rust-39713b829535b40aff2b7f368839d07ea7c2bf11.zip | |
Remove unnecessary parentheses.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 2 |
11 files changed, 21 insertions, 21 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 800172daf15..03b7f1891a1 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -46,7 +46,7 @@ impl Ident { 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 diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 598e30957e4..04a89a03852 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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() { diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 904ef91d635..15146551370 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -387,7 +387,7 @@ impl CodeMap { a = m; } } - if (a >= len) { + if a >= len { fail!("position {} does not resolve to a source location", pos.to_uint()) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 0abb6d9a313..f547f32e21d 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -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(); } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 1080291179b..dc721f15c3b 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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(); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index cb7d54d7305..facbee135ed 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -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() diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 885cfbcbdbe..f753861892f 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -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); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e79c845b24d..3a5e737e026 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3393,7 +3393,7 @@ impl Parser { 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 @@ impl Parser { 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 @@ impl Parser { 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"); } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 42313e64283..56681ef2def 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -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", diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index a6fceb086c9..82aa178e62b 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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 => () } diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 5153ddf1c7d..dd3ae168149 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -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 |
