diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-07-12 21:49:27 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-07-12 21:49:27 -0400 |
| commit | cc907f80b95c6ec530c5ee1b05b044a468f07eca (patch) | |
| tree | 47015a30be181fdb089b7daa4b8f18e9bb1d62f2 /compiler/rustc_macros | |
| parent | 67b0cfc761c9ad31a1dbacca36c42803b255f17a (diff) | |
| download | rust-cc907f80b95c6ec530c5ee1b05b044a468f07eca.tar.gz rust-cc907f80b95c6ec530c5ee1b05b044a468f07eca.zip | |
Re-format let-else per rustfmt update
Diffstat (limited to 'compiler/rustc_macros')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/subdiagnostic.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/newtype.rs | 6 |
3 files changed, 17 insertions, 7 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs index 2e6e84ad80e..e9a5cd9de97 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs @@ -203,14 +203,18 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { if first && (nested.input.is_empty() || nested.input.peek(Token![,])) { self.slug.set_once(path.clone(), path.span().unwrap()); first = false; - return Ok(()) + return Ok(()); } first = false; let Ok(nested) = nested.value() else { - span_err(nested.input.span().unwrap(), "diagnostic slug must be the first argument").emit(); - return Ok(()) + span_err( + nested.input.span().unwrap(), + "diagnostic slug must be the first argument", + ) + .emit(); + return Ok(()); }; if path.is_ident("code") { @@ -221,7 +225,9 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { #diag.code(rustc_errors::DiagnosticId::Error(#code.to_string())); }); } else { - span_err(path.span().unwrap(), "unknown argument").note("only the `code` parameter is valid after the slug").emit(); + span_err(path.span().unwrap(), "unknown argument") + .note("only the `code` parameter is valid after the slug") + .emit(); // consume the buffer so we don't have syntax errors from syn let _ = nested.parse::<TokenStream>(); diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index e8dc986914e..877e9745054 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -188,7 +188,9 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { let mut kind_slugs = vec![]; for attr in self.variant.ast().attrs { - let Some(SubdiagnosticVariant { kind, slug, no_span }) = SubdiagnosticVariant::from_attr(attr, self)? else { + let Some(SubdiagnosticVariant { kind, slug, no_span }) = + SubdiagnosticVariant::from_attr(attr, self)? + else { // Some attributes aren't errors - like documentation comments - but also aren't // subdiagnostics. continue; diff --git a/compiler/rustc_macros/src/newtype.rs b/compiler/rustc_macros/src/newtype.rs index 415a89b0f92..72b47de1abc 100644 --- a/compiler/rustc_macros/src/newtype.rs +++ b/compiler/rustc_macros/src/newtype.rs @@ -36,7 +36,8 @@ impl Parse for Newtype { false } "max" => { - let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta else { + let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta + else { panic!("#[max = NUMBER] attribute requires max value"); }; @@ -47,7 +48,8 @@ impl Parse for Newtype { false } "debug_format" => { - let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta else { + let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta + else { panic!("#[debug_format = FMT] attribute requires a format"); }; |
