Skip to content

False positive for new_without_default_derive #3632

Description

@sgrif

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)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions