Navigation Menu

Skip to content

Commit

Permalink
Use fast comparison against kw::Empty
Browse files Browse the repository at this point in the history
We think `.as_str().lines().next().is_none()` should be equivalent to
`== kw::Empty`.

Co-authored-by: Joshua Nelson <github@jyn.dev>
  • Loading branch information
camelid and jyn514 committed Nov 19, 2021
1 parent a792234 commit 7a4e2ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustdoc/passes/unindent_comments.rs
@@ -1,5 +1,7 @@
use std::cmp;

use rustc_span::symbol::kw;

use crate::clean::{self, DocFragment, DocFragmentKind, Item};
use crate::core::DocContext;
use crate::fold::{self, DocFolder};
Expand Down Expand Up @@ -87,7 +89,7 @@ fn unindent_fragments(docs: &mut Vec<DocFragment>) {
};

for fragment in docs {
if fragment.doc.as_str().lines().next().is_none() {
if fragment.doc == kw::Empty {
continue;
}

Expand Down

0 comments on commit 7a4e2ce

Please sign in to comment.