about summary refs log tree commit diff
path: root/src/librustdoc/visit_ast.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-07-27 14:58:42 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-07-29 14:39:10 +0200
commit31bb3c0cd191b9173f254ebe7371eda638af6a6c (patch)
treea5662e2fea00604713347b251774929bd343f822 /src/librustdoc/visit_ast.rs
parentf45961b60dba72a6d0be4c29872941982cc26c2e (diff)
downloadrust-31bb3c0cd191b9173f254ebe7371eda638af6a6c.tar.gz
rust-31bb3c0cd191b9173f254ebe7371eda638af6a6c.zip
Move Res check into `should_ignore_res`
Diffstat (limited to 'src/librustdoc/visit_ast.rs')
-rw-r--r--src/librustdoc/visit_ast.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 2f67e12df91..7010abc171f 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -100,6 +100,11 @@ pub(crate) fn inherits_doc_hidden(
     false
 }
 
+#[inline]
+pub(crate) fn should_ignore_res(res: Res) -> bool {
+    matches!(res, Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..))
+}
+
 pub(crate) struct RustdocVisitor<'a, 'tcx> {
     cx: &'a mut core::DocContext<'tcx>,
     view_item_stack: LocalDefIdSet,
@@ -466,7 +471,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
                 for &res in &path.res {
                     // Struct and variant constructors and proc macro stubs always show up alongside
                     // their definitions, we've already processed them so just discard these.
-                    if let Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) = res {
+                    if should_ignore_res(res) {
                         continue;
                     }