Re-format let-else per rustfmt update
This commit is contained in:
parent
67b0cfc761
commit
cc907f80b9
162 changed files with 1404 additions and 947 deletions
|
@ -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>();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue