From f32e92cdc9a1a33bf82fe4c4b77ec52169b45701 Mon Sep 17 00:00:00 2001 From: lucarlig Date: Sun, 25 Feb 2024 21:18:38 +0400 Subject: [PATCH] add 1 more test and dont trim other code --- clippy_lints/src/doc/mod.rs | 5 ++--- tests/ui/empty_docs.rs | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/doc/mod.rs b/clippy_lints/src/doc/mod.rs index 2984c5c1519..8b6256a50f4 100644 --- a/clippy_lints/src/doc/mod.rs +++ b/clippy_lints/src/doc/mod.rs @@ -17,7 +17,7 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::hir::nested_filter; use rustc_middle::lint::in_external_macro; -use rustc_middle::ty; +use rustc_middle::ty::{self}; use rustc_resolve::rustdoc::{ add_doc_fragment, attrs_to_doc_fragments, main_body_opts, source_span_for_markdown_range, DocFragment, }; @@ -556,9 +556,8 @@ fn fake_broken_link_callback<'a>(_: BrokenLink<'_>) -> Option<(CowStr<'a>, CowSt acc }); doc.pop(); - let doc = doc.trim().to_string(); - if doc.is_empty() { + if doc.trim().is_empty() { return Some(DocInfo { empty: true, doc_headers: DocHeaders::default(), diff --git a/tests/ui/empty_docs.rs b/tests/ui/empty_docs.rs index 77564c1c33d..f5b4bb6736d 100644 --- a/tests/ui/empty_docs.rs +++ b/tests/ui/empty_docs.rs @@ -59,3 +59,5 @@ fn warn() { fn dont_warn() { /*! dont warn me */ } + +trait NoDoc {}