about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsd234678 <sd234678@protonmail.com>2019-04-24 13:47:26 +0100
committersd234678 <sd234678@protonmail.com>2019-04-24 19:35:41 +0100
commit64f7cede8b8431d6c2def2720a2c3077db948b73 (patch)
tree8151245c6a97b1491ee32065f76bb69fb8f358e6
parent112f7e9ac564e2cfcfc13d599c8376a219fde1bc (diff)
downloadrust-64f7cede8b8431d6c2def2720a2c3077db948b73.tar.gz
rust-64f7cede8b8431d6c2def2720a2c3077db948b73.zip
Derive Default instead of new in applicable lint
-rw-r--r--src/librustc_lint/builtin.rs7
-rw-r--r--src/librustc_lint/lib.rs2
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<HirIdSet>,
 }
 
 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(),
         ]);
     )
 }