diff options
| author | bors <bors@rust-lang.org> | 2014-02-22 10:26:46 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-22 10:26:46 -0800 |
| commit | eb5ba4d2690f29c8ced9092fe4af719e27991bbc (patch) | |
| tree | bcc3c41d0a1a93db75b1013029b0ed56a126ee45 /src/libsyntax | |
| parent | 87e3b5fe7fc5e601f502a82b4bd73da5c07c59f2 (diff) | |
| parent | 9982de6397197a63a093e7b79851d1915ef783d7 (diff) | |
| download | rust-eb5ba4d2690f29c8ced9092fe4af719e27991bbc.tar.gz rust-eb5ba4d2690f29c8ced9092fe4af719e27991bbc.zip | |
auto merge of #12366 : aepsil0n/rust/feature/unnecessary_parens_around_assigned_values, r=alexcrichton
Fixes #12350. Parentheses around assignment statements such as ```rust let mut a = (0); a = (1); a += (2); ``` are not necessary and therefore an unnecessary_parens warning is raised when statements like this occur. NOTE: In `let` declarations this does not work as intended. Is it possible that they do not count as assignment expressions (`ExprAssign`)? (edit: this is fixed by now) Furthermore, there are some cases that I fixed in the rest of the code, where parentheses could potentially enhance readability. Compare these lines: ```rust a = b == c; a = (b == c); ``` Thus, after having worked on this I'm not entirely sure, whether we should go through with this patch or not. Probably a matter of debate. ;)
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/abi.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 6b0f2c6e516..82e4d08d077 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -202,7 +202,7 @@ impl AbiSet { } pub fn add(&mut self, abi: Abi) { - self.bits |= (1 << abi.index()); + self.bits |= 1 << abi.index(); } pub fn each(&self, op: |abi: Abi| -> bool) -> bool { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e8edc1a0dfc..c436dc018e7 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1224,6 +1224,6 @@ mod test { }, }; // doesn't matter which encoder we use.... - let _f = (&e as &serialize::Encodable<json::Encoder>); + let _f = &e as &serialize::Encodable<json::Encoder>; } } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 9455df063f1..8cf0f128d22 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -329,7 +329,7 @@ fn highlight_lines(cm: &codemap::CodeMap, for _ in range(0, skip) { s.push_char(' '); } let orig = fm.get_line(lines.lines[0] as int); for pos in range(0u, left-skip) { - let curChar = (orig[pos] as char); + let curChar = orig[pos] as char; // Whenever a tab occurs on the previous line, we insert one on // the error-point-squiggly-line as well (instead of a space). // That way the squiggly line will usually appear in the correct |
