From 390893c600aae5c1b463de99627dea4cfc4866db Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 18 May 2021 21:46:41 -0400 Subject: [PATCH] Remove `doc(include)` --- clippy_lints/src/missing_doc.rs | 19 ++----------------- tests/ui/missing-doc-crate.rs | 3 +-- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index ec1572c26c262..a46a7407df0ce 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -7,8 +7,7 @@ use clippy_utils::attrs::is_doc_hidden; use clippy_utils::diagnostics::span_lint; -use if_chain::if_chain; -use rustc_ast::ast::{self, MetaItem, MetaItemKind}; +use rustc_ast::ast; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::ty; @@ -56,20 +55,6 @@ impl MissingDoc { *self.doc_hidden_stack.last().expect("empty doc_hidden_stack") } - fn has_include(meta: Option) -> bool { - if_chain! { - if let Some(meta) = meta; - if let MetaItemKind::List(list) = meta.kind; - if let Some(meta) = list.get(0); - if let Some(name) = meta.ident(); - then { - name.name == sym::include - } else { - false - } - } - } - fn check_missing_docs_attrs( &self, cx: &LateContext<'_>, @@ -95,7 +80,7 @@ impl MissingDoc { let has_doc = attrs .iter() - .any(|a| a.doc_str().is_some() || Self::has_include(a.meta())); + .any(|a| a.doc_str().is_some()); if !has_doc { span_lint( cx, diff --git a/tests/ui/missing-doc-crate.rs b/tests/ui/missing-doc-crate.rs index 04711f864886b..e00c7fbfed157 100644 --- a/tests/ui/missing-doc-crate.rs +++ b/tests/ui/missing-doc-crate.rs @@ -1,5 +1,4 @@ #![warn(clippy::missing_docs_in_private_items)] -#![feature(external_doc)] -#![doc(include = "../../README.md")] +#![doc = include_str!("../../README.md")] fn main() {}