]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/zero_sized_map_values.rs
modify code
[rust.git] / clippy_lints / src / zero_sized_map_values.rs
index eb8436a501d54b057010db4c95b6f67a68a9452e..70b0560e676044eef19feef0cff8f9733f5394d8 100644 (file)
@@ -69,7 +69,11 @@ fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>) {
 
 fn in_trait_impl(cx: &LateContext<'_>, hir_id: HirId) -> bool {
     let parent_id = cx.tcx.hir().get_parent_item(hir_id);
-    if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_item(parent_id)) {
+    let second_parent_id = cx
+        .tcx
+        .hir()
+        .get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(parent_id));
+    if let Some(Node::Item(item)) = cx.tcx.hir().find_by_def_id(second_parent_id) {
         if let ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) = item.kind {
             return true;
         }