Skip to content

Commit 7a4e2ce

Browse files
camelidjyn514
andcommitted
Use fast comparison against kw::Empty
We think `.as_str().lines().next().is_none()` should be equivalent to `== kw::Empty`. Co-authored-by: Joshua Nelson <[email protected]>
1 parent a792234 commit 7a4e2ce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustdoc/passes/unindent_comments.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::cmp;
22

3+
use rustc_span::symbol::kw;
4+
35
use crate::clean::{self, DocFragment, DocFragmentKind, Item};
46
use crate::core::DocContext;
57
use crate::fold::{self, DocFolder};
@@ -87,7 +89,7 @@ fn unindent_fragments(docs: &mut Vec<DocFragment>) {
8789
};
8890

8991
for fragment in docs {
90-
if fragment.doc.as_str().lines().next().is_none() {
92+
if fragment.doc == kw::Empty {
9193
continue;
9294
}
9395

0 commit comments

Comments
 (0)