Skip to content

Commit 53b2aca

Browse files
committed
Refactor loop into iterator; simplify negation logic.
1 parent dc4bfcb commit 53b2aca

File tree

1 file changed

+2
-8
lines changed
  • compiler/rustc_error_messages/src

1 file changed

+2
-8
lines changed

compiler/rustc_error_messages/src/lib.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,12 @@ impl MultiSpan {
320320

321321
/// Returns `true` if any of the primary spans are displayable.
322322
pub fn has_primary_spans(&self) -> bool {
323-
self.primary_spans.iter().any(|sp| !sp.is_dummy())
323+
!self.primary_spans.iter().all(|sp| sp.is_dummy())
324324
}
325325

326326
/// Returns `true` if this contains only a dummy primary span with any hygienic context.
327327
pub fn is_dummy(&self) -> bool {
328-
let mut is_dummy = true;
329-
for span in &self.primary_spans {
330-
if !span.is_dummy() {
331-
is_dummy = false;
332-
}
333-
}
334-
is_dummy
328+
self.primary_spans.iter().all(|sp| sp.is_dummy())
335329
}
336330

337331
/// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't

0 commit comments

Comments
 (0)