Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple enum variant generates unused_parens warning for Deserialize #1172

Closed
compressed opened this issue Mar 9, 2018 · 2 comments
Closed
Labels

Comments

@compressed
Copy link
Contributor

After updating to 1.0.28 I started receiving an unused parens warning for an enum containing a tuple variant with at least two arguments (i.e. A(usize) won't trigger the warning). I don't get this warning on 1.0.27.

Example:

extern crate serde;
#[macro_use]
extern crate serde_derive;

#[derive(Serialize, Deserialize)]
enum A {
    A(usize, usize),
}

Output:

warning: unnecessary parentheses around function argument
 --> src/lib.rs:5:21
  |
5 | #[derive(Serialize, Deserialize)]
  |                     ^^^^^^^^^^^ help: remove these parentheses
  |
  = note: #[warn(unused_parens)] on by default

warning: unnecessary parentheses around function argument
 --> src/lib.rs:5:21
  |
5 | #[derive(Serialize, Deserialize)]
  |                     ^^^^^^^^^^^ help: remove these parentheses

    Finished dev [unoptimized + debuginfo] target(s) in 0.19 secs
@dtolnay
Copy link
Member

dtolnay commented Mar 9, 2018

Thanks! The parentheses used to be a workaround for a compiler issue that has since been fixed: rust-lang/rust#47311. I removed the workaround in 30361ac and released 1.0.29 which should have no warnings.

@dtolnay dtolnay closed this as completed Mar 9, 2018
@compressed
Copy link
Contributor Author

Thanks for the quick turnaround! No more warnings now 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants