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

Unable to allow unused_self after enabling pedantic #5053

Closed
martinthomson opened this issue Jan 16, 2020 · 1 comment · Fixed by #5063
Closed

Unable to allow unused_self after enabling pedantic #5053

martinthomson opened this issue Jan 16, 2020 · 1 comment · Fixed by #5063

Comments

@martinthomson
Copy link

This code:

#![deny(warnings)]
#![warn(clippy::pedantic)]

struct X {}
impl X {
    #[allow(clippy::unused_self, clippy::cast_possible_truncation)]
    fn test(&self, a: u32) {
        println!("testing {}", a as u16);
    }
}
pub fn main() {
    let x = X {};
    x.test(1);
}

This correctly suppresses the clippy::cast_possible_truncation warning, but fails to suppress the clippy::unused_self.

The rust playground is currently at 0.0.212 (2019-12-29 c807fbc).
The same error is produced by clippy 0.0.212 (c8e3cfb 2019-10-28).
Older versions I have access to, such as clippy 0.0.212 (4e7e71b 2019-10-11) don't have this lint, so it's hard to pin down.

@taiki-e
Copy link
Member

taiki-e commented Jan 16, 2020

A workaround for this is to use #[allow(clippy::unused_self)] on impl block: playground

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

Successfully merging a pull request may close this issue.

2 participants