]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #12366 : aepsil0n/rust/feature/unnecessary_parens_around_assigned_value...
authorbors <bors@rust-lang.org>
Sat, 22 Feb 2014 18:26:46 +0000 (10:26 -0800)
committerbors <bors@rust-lang.org>
Sat, 22 Feb 2014 18:26:46 +0000 (10:26 -0800)
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. ;)

1  2 
src/librustc/middle/ty.rs

Simple merge