mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Refactor loop into iterator; simplify negation logic.
This commit is contained in:
parent
dc4bfcbdff
commit
53b2aca9da
@ -320,18 +320,12 @@ impl MultiSpan {
|
||||
|
||||
/// Returns `true` if any of the primary spans are displayable.
|
||||
pub fn has_primary_spans(&self) -> bool {
|
||||
self.primary_spans.iter().any(|sp| !sp.is_dummy())
|
||||
!self.primary_spans.iter().all(|sp| sp.is_dummy())
|
||||
}
|
||||
|
||||
/// Returns `true` if this contains only a dummy primary span with any hygienic context.
|
||||
pub fn is_dummy(&self) -> bool {
|
||||
let mut is_dummy = true;
|
||||
for span in &self.primary_spans {
|
||||
if !span.is_dummy() {
|
||||
is_dummy = false;
|
||||
}
|
||||
}
|
||||
is_dummy
|
||||
self.primary_spans.iter().all(|sp| sp.is_dummy())
|
||||
}
|
||||
|
||||
/// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't
|
||||
|
Loading…
Reference in New Issue
Block a user