From 64f7cede8b8431d6c2def2720a2c3077db948b73 Mon Sep 17 00:00:00 2001 From: sd234678 Date: Wed, 24 Apr 2019 13:47:26 +0100 Subject: [PATCH] Derive Default instead of new in applicable lint --- src/librustc_lint/builtin.rs | 7 +------ src/librustc_lint/lib.rs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 57bc44ee30c..c01c3340303 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -542,18 +542,13 @@ declare_lint! { "detects missing implementations of fmt::Debug" } +#[derive(Default)] pub struct MissingDebugImplementations { impling_types: Option, } impl_lint_pass!(MissingDebugImplementations => [MISSING_DEBUG_IMPLEMENTATIONS]); -impl MissingDebugImplementations { - pub fn new() -> MissingDebugImplementations { - MissingDebugImplementations { impling_types: None } - } -} - impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations { fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) { if !cx.access_levels.is_reachable(item.hir_id) { diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 68ea2195619..e7e6ffac517 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -132,7 +132,7 @@ macro_rules! late_lint_passes { // Depends on access levels // FIXME: Turn the computation of types which implement Debug into a query // and change this to a module lint pass - MissingDebugImplementations: MissingDebugImplementations::new(), + MissingDebugImplementations: MissingDebugImplementations::default(), ]); ) }