Skip to content

Commit 54a5666

Browse files
committed
Rename has_missing_errors to has_unformatted_original_code
1 parent 4eb31fb commit 54a5666

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/formatting.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub(crate) struct ReportedErrors {
333333
pub(crate) has_diff: bool,
334334

335335
/// Formatted code missed something, like lost comments or extra trailing space
336-
pub(crate) has_missing_errors: bool,
336+
pub(crate) has_unformatted_original_code: bool,
337337
}
338338

339339
impl ReportedErrors {
@@ -345,7 +345,7 @@ impl ReportedErrors {
345345
self.has_macro_format_failure |= other.has_macro_format_failure;
346346
self.has_check_errors |= other.has_check_errors;
347347
self.has_diff |= other.has_diff;
348-
self.has_missing_errors |= other.has_missing_errors;
348+
self.has_unformatted_original_code |= other.has_unformatted_original_code;
349349
}
350350
}
351351

src/lib.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ impl FormatReport {
210210
if !new_errors.is_empty() {
211211
errs.has_formatting_errors = true;
212212
}
213-
if errs.has_operational_errors && errs.has_check_errors && errs.has_missing_errors {
213+
if errs.has_operational_errors
214+
&& errs.has_check_errors
215+
&& errs.has_unformatted_original_code
216+
{
214217
return;
215218
}
216219
for err in new_errors {
@@ -220,10 +223,10 @@ impl FormatReport {
220223
}
221224
ErrorKind::TrailingWhitespace => {
222225
errs.has_operational_errors = true;
223-
errs.has_missing_errors = true;
226+
errs.has_unformatted_original_code = true;
224227
}
225228
ErrorKind::LostComment => {
226-
errs.has_missing_errors = true;
229+
errs.has_unformatted_original_code = true;
227230
}
228231
ErrorKind::BadIssue(_)
229232
| ErrorKind::LicenseCheck
@@ -313,7 +316,7 @@ fn format_snippet(snippet: &str, config: &Config, is_macro_def: bool) -> Option<
313316
session.errors.has_macro_format_failure
314317
|| session.out.as_ref().unwrap().is_empty() && !snippet.is_empty()
315318
|| result.is_err()
316-
|| (is_macro_def && session.has_missing_errors()),
319+
|| (is_macro_def && session.has_unformatted_original_code()),
317320
result,
318321
)
319322
};
@@ -488,8 +491,8 @@ impl<'b, T: Write + 'b> Session<'b, T> {
488491
self.errors.has_diff
489492
}
490493

491-
pub fn has_missing_errors(&self) -> bool {
492-
self.errors.has_missing_errors
494+
pub fn has_unformatted_original_code(&self) -> bool {
495+
self.errors.has_unformatted_original_code
493496
}
494497

495498
pub fn has_no_errors(&self) -> bool {
@@ -498,7 +501,7 @@ impl<'b, T: Write + 'b> Session<'b, T> {
498501
|| self.has_formatting_errors()
499502
|| self.has_check_errors()
500503
|| self.has_diff()
501-
|| self.has_missing_errors()
504+
|| self.has_unformatted_original_code()
502505
|| self.errors.has_macro_format_failure)
503506
}
504507
}

0 commit comments

Comments
 (0)