Skip to content

Commit

Permalink
Using the is_empty method of a span
Browse files Browse the repository at this point in the history
  • Loading branch information
kper committed Oct 15, 2022
1 parent da10a05 commit 1d970c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ impl Diagnostic {
) -> &mut Self {
assert!(!suggestion.is_empty());
debug_assert!(
!(suggestion.iter().any(|(sp, text)| sp.lo() == sp.hi() && text.is_empty())),
!(suggestion.iter().any(|(sp, text)| sp.is_empty() && text.is_empty())),
"Span must not be empty and have no suggestion"
);

Expand Down Expand Up @@ -650,7 +650,7 @@ impl Diagnostic {
style: SuggestionStyle,
) -> &mut Self {
debug_assert!(
!(sp.lo() == sp.hi() && suggestion.to_string().is_empty()),
!(sp.is_empty() && suggestion.to_string().is_empty()),
"Span must not be empty and have no suggestion"
);
self.push_suggestion(CodeSuggestion {
Expand Down Expand Up @@ -695,7 +695,7 @@ impl Diagnostic {
suggestions.sort();

debug_assert!(
!(sp.lo() == sp.hi() && suggestions.iter().any(|suggestion| suggestion.is_empty())),
!(sp.is_empty() && suggestions.iter().any(|suggestion| suggestion.is_empty())),
"Span must not be empty and have no suggestion"
);

Expand Down Expand Up @@ -725,7 +725,7 @@ impl Diagnostic {
!(suggestions
.iter()
.flat_map(|suggs| suggs)
.any(|(sp, suggestion)| sp.lo() == sp.hi() && suggestion.is_empty())),
.any(|(sp, suggestion)| sp.is_empty() && suggestion.is_empty())),
"Span must not be empty and have no suggestion"
);

Expand Down

0 comments on commit 1d970c3

Please sign in to comment.