Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 09c7c5d

Browse files
committed
fix bug in check_exprs
1 parent 84219f4 commit 09c7c5d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

clippy_lints/src/doc/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,14 @@ fn check_attrs(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs: &[
533533
suspicious_doc_comments::check(cx, attrs);
534534

535535
let (fragments, _) = attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), true);
536-
let mut doc = String::new();
537-
for fragment in &fragments {
538-
add_doc_fragment(&mut doc, fragment);
539-
}
536+
let mut doc = fragments
537+
.iter()
538+
.fold(String::new(), |mut acc, fragment| {
539+
add_doc_fragment(&mut acc, fragment);
540+
acc
541+
})
542+
.trim()
543+
.to_string();
540544
doc.pop();
541545

542546
if doc.is_empty() {

0 commit comments

Comments
 (0)