X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Fbuiltin.rs;h=697e90fdaa95aba13d8a08ce1f6145aa6c30112a;hb=fd649a3cc5e9f17c8aee070227e8c71f094560b7;hp=8361c81f0efe35f63d22fe9bc08ce52217e0d2b1;hpb=0f86ada9d8095a2cc61bfaf0b21f872e34602674;p=rust.git diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 8361c81f0ef..697e90fdaa9 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -580,27 +580,28 @@ fn check_trait_item(&mut self, cx: &LateContext<'_>, trait_item: &hir::TraitItem } fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) { - // If the method is an impl for a trait, don't doc. let context = method_context(cx, impl_item.owner_id.def_id); - if context == MethodLateContext::TraitImpl { - return; - } - - // If the method is an impl for an item with docs_hidden, don't doc. - if context == MethodLateContext::PlainImpl { - let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id()); - let impl_ty = cx.tcx.type_of(parent); - let outerdef = match impl_ty.kind() { - ty::Adt(def, _) => Some(def.did()), - ty::Foreign(def_id) => Some(*def_id), - _ => None, - }; - let is_hidden = match outerdef { - Some(id) => cx.tcx.is_doc_hidden(id), - None => false, - }; - if is_hidden { - return; + + match context { + // If the method is an impl for a trait, don't doc. + MethodLateContext::TraitImpl => return, + MethodLateContext::TraitAutoImpl => {} + // If the method is an impl for an item with docs_hidden, don't doc. + MethodLateContext::PlainImpl => { + let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id()); + let impl_ty = cx.tcx.type_of(parent); + let outerdef = match impl_ty.kind() { + ty::Adt(def, _) => Some(def.did()), + ty::Foreign(def_id) => Some(*def_id), + _ => None, + }; + let is_hidden = match outerdef { + Some(id) => cx.tcx.is_doc_hidden(id), + None => false, + }; + if is_hidden { + return; + } } }