Closed
Description
fn main() {
if (return) {}
}
sez:
<anon>:2:8: 2:16 warning: unnecessary parentheses around `if` condition, #[warn(unused_parens)] on by default
<anon>:2 if (return) {}
^~~~~~~~
However, removing the parentheses makes the file have illegal syntax, because {}
is part of the return expression (so the if
is missing its arm).
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
tomjakubowski commentedon Jun 21, 2015
Also, by the way, it's very amusing to me that this is legal:
samdoiron commentedon Nov 26, 2015
Triage: Warning still generated in nightly build. Seems to be an issue with
contains_exterior_struct_lit
not identifyingreturn {}
as an exterior expression.euclio commentedon Dec 4, 2018
Looks like this was fixed in #55166, and there's a test.