Skip to content

False positive for new_without_default_derive #3632

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

Closed
sgrif opened this issue Jan 4, 2019 · 2 comments
Closed

False positive for new_without_default_derive #3632

sgrif opened this issue Jan 4, 2019 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@sgrif
Copy link

sgrif commented Jan 4, 2019

Given the following code:

use std::collections::HashMap;

#[derive(Default)]
#[allow(missing_debug_implementations)] // Can't derive debug
pub struct Registry<Env> {
    job_types: HashMap<&'static str, Env>,
}

impl<Env> Registry<Env> {
    pub fn new() -> Self {
        Registry {
            job_types: Default::default(),
        }
    }
}

Clippy will suggest adding #[derive(Default)] on a struct that already has it.

Rust 1.31.1
clippy 0.0.212 (2e26fdc 2018-11-22)

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Jan 4, 2019
@ghost
Copy link

ghost commented Jan 6, 2019

I can't reproduce this error on the playground.
The playground's current version 0.0.212 (2018-12-30 39bd844).
Playground

@flip1995
Copy link
Member

flip1995 commented Jan 7, 2019

Maybe this was fixed in #3558.

@flip1995 flip1995 closed this as completed Jan 7, 2019
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
Projects
None yet
Development

No branches or pull requests

2 participants