1
Fork 0

Format all the let chains in compiler

This commit is contained in:
Michael Goulet 2023-10-13 08:58:33 +00:00
parent 2763ca50da
commit b2d2184ede
206 changed files with 3120 additions and 2228 deletions

View file

@ -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

View file

@ -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
);
}

View file

@ -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!(