]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/new_without_default.rs
modify code
[rust.git] / clippy_lints / src / new_without_default.rs
index 0ac27f1cba2262ce1a8c1423678ac787b67d966e..aec95530bba67ea3b3d2faaeaf93cec7b9612c44 100644 (file)
@@ -45,6 +45,7 @@
     ///     }
     /// }
     /// ```
+    #[clippy::version = "pre 1.29.0"]
     pub NEW_WITHOUT_DEFAULT,
     style,
     "`fn new() -> Self` method without `Default` implementation"
@@ -100,7 +101,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
                             if sig.decl.inputs.is_empty();
                             if name == sym::new;
                             if cx.access_levels.is_reachable(impl_item.def_id);
-                            let self_def_id = cx.tcx.hir().local_def_id(cx.tcx.hir().get_parent_item(id));
+                            let self_def_id = cx.tcx.hir().get_parent_item(id);
                             let self_ty = cx.tcx.type_of(self_def_id);
                             if TyS::same_type(self_ty, return_ty(cx, id));
                             if let Some(default_trait_id) = cx.tcx.get_diagnostic_item(sym::Default);