diff options
| author | Michael Goulet <michael@errs.io> | 2023-10-13 08:58:33 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-10-13 08:59:36 +0000 |
| commit | b2d2184edea578109a48ec3d8decbee5948e8f35 (patch) | |
| tree | 84a351b1b08b838e0adcb1062ec04c344524e6c2 /compiler/rustc_errors/src | |
| parent | 2763ca50da1192aa28295ef4dbe5d06443e1b90a (diff) | |
| download | rust-b2d2184edea578109a48ec3d8decbee5948e8f35.tar.gz rust-b2d2184edea578109a48ec3d8decbee5948e8f35.zip | |
Format all the let chains in compiler
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/tests.rs | 24 |
3 files changed, 23 insertions, 15 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d322cbe9d9b..922846775f6 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -337,9 +337,7 @@ pub trait Emitter: Translate { && last_name != name { let descr = macro_kind.descr(); - format!( - " which comes from the expansion of the {descr} `{last_name}`", - ) + format!(" which comes from the expansion of the {descr} `{last_name}`",) } else { "".to_string() }; @@ -1935,7 +1933,9 @@ impl EmitterWriter { is_multiline, ) } - if let DisplaySuggestion::Add = show_code_change && is_item_attribute { + if let DisplaySuggestion::Add = show_code_change + && is_item_attribute + { // The suggestion adds an entire line of code, ending on a newline, so we'll also // print the *following* line, to provide context of what we're advising people to // do. Otherwise you would only see contextless code that can be confused for diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 63226504d37..c2af7f38d70 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1673,7 +1673,11 @@ impl HandlerInner { let _ = write!( &mut out, "delayed span bug: {}\n{}\n", - bug.inner.styled_message().iter().filter_map(|(msg, _)| msg.as_str()).collect::<String>(), + bug.inner + .styled_message() + .iter() + .filter_map(|(msg, _)| msg.as_str()) + .collect::<String>(), &bug.note ); } diff --git a/compiler/rustc_errors/src/tests.rs b/compiler/rustc_errors/src/tests.rs index 0e729b71680..79a2af7f38f 100644 --- a/compiler/rustc_errors/src/tests.rs +++ b/compiler/rustc_errors/src/tests.rs @@ -151,12 +151,14 @@ fn misformed_fluent() { primary: box TranslateError::One { kind: TranslateErrorKind::PrimaryBundleMissing, .. }, fallback: box TranslateError::One { kind: TranslateErrorKind::Fluent { errs }, .. }, } = &err - && let [FluentError::ResolverError(ResolverError::Reference( - ReferenceKind::Message { id, .. } - | ReferenceKind::Variable { id, .. }, - ))] = &**errs + && let [ + FluentError::ResolverError(ResolverError::Reference( + ReferenceKind::Message { id, .. } | ReferenceKind::Variable { id, .. }, + )), + ] = &**errs && id == "name" - {} else { + { + } else { panic!("{err:#?}") }; assert_eq!( @@ -176,12 +178,14 @@ fn misformed_fluent() { primary: box TranslateError::One { kind: TranslateErrorKind::PrimaryBundleMissing, .. }, fallback: box TranslateError::One { kind: TranslateErrorKind::Fluent { errs }, .. }, } = &err - && let [FluentError::ResolverError(ResolverError::Reference( - ReferenceKind::Message { id, .. } - | ReferenceKind::Variable { id, .. }, - ))] = &**errs + && let [ + FluentError::ResolverError(ResolverError::Reference( + ReferenceKind::Message { id, .. } | ReferenceKind::Variable { id, .. }, + )), + ] = &**errs && id == "oops" - {} else { + { + } else { panic!("{err:#?}") }; assert_eq!( |
