A few minor lints and docs (#1436)

* A few minor lints and docs

* Added required packages to compile on Debian-style linux
* Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline)
* a few spelling mistakes

* fix fmt
This commit is contained in:
Yuri Astrakhan 2023-10-19 02:33:10 -04:00 committed by GitHub
parent 67edac4aca
commit 3d4e3a74e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 140 additions and 158 deletions

View file

@ -116,7 +116,7 @@ fn top_level_impl(input_item: TokenStream) -> syn::Result<TokenStream> {
}
let input_type = &input.ident;
let discriminant = call_site_ident(format!("{}Discriminant", input_type));
let discriminant = call_site_ident(format!("{input_type}Discriminant"));
Ok(quote::quote! {
#input

View file

@ -24,7 +24,7 @@ pub fn derive_discriminant_impl(input_item: TokenStream) -> syn::Result<TokenStr
};
is_sub_discriminant.push(true);
}
n => unimplemented!("#[sub_discriminant] on variants with {} fields is not supported (for now)", n),
n => unimplemented!("#[sub_discriminant] on variants with {n} fields is not supported (for now)"),
}
} else {
var.fields = Fields::Unit;

View file

@ -21,7 +21,7 @@ fn parse_hint_helper_attrs(attrs: &[Attribute]) -> syn::Result<(Vec<LitStr>, Vec
// the first value is ok, the other ones should error
let after_first = v.into_iter().skip(1);
// this call to fold_error_iter will always return Err with a combined error
fold_error_iter(after_first.map(|lit| Err(syn::Error::new(lit.span(), format!("value for key {} was already given", k))))).map(|_: Vec<()>| unreachable!())
fold_error_iter(after_first.map(|lit| Err(syn::Error::new(lit.span(), format!("value for key {k} was already given"))))).map(|_: Vec<()>| unreachable!())
}
}))
})