You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if the code contains unnecessary parenthesis, clippy doesn't warn the user about it. It would be nice if there was some new lint to detect these cases and warn the user about them.
Lint Name
No response
Category
style
Advantage
Remove unnecessary parenthesis in the code
Drawbacks
No response
Example
fnnew_rect(x:f64,y:f64,width:f64,height:f64){println!("I am arectangle({x},{y})({width},{height})");}fnmain(){let x = 0f32;let y = 0f32;let width = 100f32;let height = 100f32;new_rect((x)asf64,(y)asf64,(width)asf64,(height)asf64);}
Could be written as:
fnnew_rect(x:f64,y:f64,width:f64,height:f64){println!("I am arectangle({x},{y})({width},{height})");}fnmain(){let x = 0f32;let y = 0f32;let width = 100f32;let height = 100f32;new_rect(x asf64, y asf64, width asf64, height asf64);}
The text was updated successfully, but these errors were encountered:
rustc has an unused_parens lint, this might be a shortcoming of that lint. notably some_fn((x)) and let _ = (x);do have a warning triggered, so it might be something to do with being part of the as cast there?
Edit: it is not always possible to remove the parens in an as cast, for example removing the parentheses in (1 + 2) as f32 makes it stop compiling, since 1 + 2 as f32 parses as 1 + (2 as f32), which is {integer} + f32 and so presumably rustc doesn't attempt to check unused parens in this case, to be on the safe side.
What it does
Currently, if the code contains unnecessary parenthesis, clippy doesn't warn the user about it. It would be nice if there was some new lint to detect these cases and warn the user about them.
Lint Name
No response
Category
style
Advantage
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: