| @@ -1036,20 +1036,18 @@ impl Clean for hir::ImplItem<'_> { |
|
|
| 1036 |
1036 |
} |
| 1037 |
1037 |
}; |
| 1038 |
1038 |
|
| 1039 |
|
-let what_rustc_thinks = |
|
1039 |
+let mut what_rustc_thinks = |
| 1040 |
1040 |
Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx); |
| 1041 |
|
-let parent_item = cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(self.hir_id())); |
| 1042 |
|
-if let hir::ItemKind::Impl(impl_) = &parent_item.kind { |
| 1043 |
|
-if impl_.of_trait.is_some() { |
| 1044 |
|
-// Trait impl items always inherit the impl's visibility -- |
| 1045 |
|
-// we don't want to show `pub`. |
| 1046 |
|
-Item { visibility: Inherited, ..what_rustc_thinks } |
| 1047 |
|
-} else { |
| 1048 |
|
- what_rustc_thinks |
| 1049 |
|
-} |
| 1050 |
|
-} else { |
| 1051 |
|
-panic!("found impl item with non-impl parent {:?}", parent_item); |
|
1041 |
+ |
|
1042 |
+let impl_ref = cx.tcx.parent(local_did).and_then(|did |
|
1043 |
+ |
|
1044 |
+// Trait impl items always inherit the impl's visibility -- |
|
1045 |
+// we don't want to show `pub`. |
|
1046 |
+if impl_ref.is_some() { |
|
1047 |
+ what_rustc_thinks.visibility = Inherited; |
| 1052 |
1048 |
} |
|
1049 |
+ |
|
1050 |
+ what_rustc_thinks |
| 1053 |
1051 |
}) |
| 1054 |
1052 |
} |
| 1055 |
1053 |
} |
| @@ -1204,16 +1202,18 @@ impl Clean for ty::AssocItem { |
|
|
| 1204 |
1202 |
} |
| 1205 |
1203 |
}; |
| 1206 |
1204 |
|
| 1207 |
|
-let mut output = Item::from_def_id_and_parts(self.def_id, Some(self.name), kind, cx); |
|
1205 |
+let mut what_rustc_thinks = |
|
1206 |
+Item::from_def_id_and_parts(self.def_id, Some(self.name), kind, cx); |
| 1208 |
1207 |
|
| 1209 |
|
-// HACK: Override visibility for items in a trait implementation to match HIR |
| 1210 |
1208 |
let impl_ref = tcx.parent(self.def_id).and_then(|did |
| 1211 |
1209 |
|
|
1210 |
+// Trait impl items always inherit the impl's visibility -- |
|
1211 |
+// we don't want to show `pub`. |
| 1212 |
1212 |
if impl_ref.is_some() { |
| 1213 |
|
-output.visibility = Visibility::Inherited; |
|
1213 |
+what_rustc_thinks.visibility = Visibility::Inherited; |
| 1214 |
1214 |
} |
| 1215 |
1215 |
|
| 1216 |
|
-output |
|
1216 |
+what_rustc_thinks |
| 1217 |
1217 |
} |
| 1218 |
1218 |
} |
| 1219 |
1219 |
|