From 9982de6397197a63a093e7b79851d1915ef783d7 Mon Sep 17 00:00:00 2001 From: Eduard Bopp Date: Tue, 18 Feb 2014 13:40:25 +0100 Subject: Warn about unnecessary parentheses upon assignment Closes #12366. Parentheses around assignment statements such as let mut a = (0); a = (1); a += (2); are not necessary and therefore an unnecessary_parens warning is raised when statements like this occur. The warning mechanism was refactored along the way to allow for code reuse between the routines for checking expressions and statements. Code had to be adopted throughout the compiler and standard libraries to comply with this modification of the lint. --- src/libstd/os.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 458e31fd86f..fdd81179325 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -119,7 +119,7 @@ pub mod win32 { } else if k == n && libc::GetLastError() == libc::ERROR_INSUFFICIENT_BUFFER as DWORD { - n *= (2 as DWORD); + n *= 2 as DWORD; } else if k >= n { n = k; } else { @@ -225,7 +225,7 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] { for p in input.iter() { let vs: ~[&[u8]] = p.splitn(1, |b| *b == '=' as u8).collect(); let key = vs[0].to_owned(); - let val = (if vs.len() < 2 { ~[] } else { vs[1].to_owned() }); + let val = if vs.len() < 2 { ~[] } else { vs[1].to_owned() }; pairs.push((key, val)); } pairs -- cgit 1.4.1-3-g733a5