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

used_underscore_binding trigged on #[derive(Serialize)] using serde #852

Closed
compressed opened this issue Apr 12, 2016 · 4 comments · Fixed by #4011
Closed

used_underscore_binding trigged on #[derive(Serialize)] using serde #852

compressed opened this issue Apr 12, 2016 · 4 comments · Fixed by #4011
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy T-middle Type: Probably requires verifiying types

Comments

@compressed
Copy link

Similar to https://github.com/Manishearth/rust-clippy/issues/536, I'm getting this clippy warning on the expansion of Serialize.

Cargo.toml

[dependencies]
clippy = "0.0.63"
serde = "0.7.0"
serde_macros = "0.7.2"

lib.rs

#![feature(custom_derive, plugin)]
#![plugin(serde_macros, clippy)]

extern crate serde;

#[derive(Serialize)]
pub struct A {
    a: String,
}

Returns:

src/lib.rs:7:10: 7:19 warning: used binding which is prefixed with an underscore. A leading underscore signals that a binding will not be used., #[warn(used_underscore_binding)] on by default
src/lib.rs:7 #[derive(Serialize)]
                      ^~~~~~~~~
src/lib.rs:7:10: 7:19 note: in this expansion of try! (defined in <std macros>)
src/lib.rs:7:10: 7:19 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#used_underscore_binding
@llogiq
Copy link
Contributor

llogiq commented Apr 12, 2016

Good catch! It seems this lint should have a stricter macro check.

@euclio
Copy link
Contributor

euclio commented Apr 13, 2016

FWIW, maplit's btreemap! and map! macros also trigger this warning.

@llogiq
Copy link
Contributor

llogiq commented Apr 18, 2016

Also bitflags!.

@indiv0
Copy link

indiv0 commented Sep 14, 2016

Any progress on this?

@oli-obk oli-obk added good-first-issue These issues are a good way to get started with Clippy C-bug Category: Clippy is not doing the correct thing T-middle Type: Probably requires verifiying types labels May 10, 2017
@phansch phansch self-assigned this Apr 19, 2019
phansch added a commit to phansch/rust-clippy that referenced this issue Apr 20, 2019
This closes rust-lang#852 as I can't reproduce the original issue anymore.
bors added a commit that referenced this issue Apr 20, 2019
Add test for derives for used_underscore_binding lint

This closes #852 as I can't reproduce the original issue anymore.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants