Apply clippy suggestions
This commit is contained in:
parent
15491d7b6b
commit
71dd0b928b
22 changed files with 55 additions and 70 deletions
|
@ -24,11 +24,9 @@ fn parse_attributes(field: &syn::Field) -> Attributes {
|
|||
}
|
||||
if meta.path().is_ident("project") {
|
||||
if let Meta::List(list) = meta {
|
||||
if let Some(nested) = list.nested.iter().next() {
|
||||
if let NestedMeta::Meta(meta) = nested {
|
||||
attrs.project = meta.path().get_ident().cloned();
|
||||
any_attr = true;
|
||||
}
|
||||
if let Some(NestedMeta::Meta(meta)) = list.nested.iter().next() {
|
||||
attrs.project = meta.path().get_ident().cloned();
|
||||
any_attr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,14 +349,14 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
|
|||
) -> Result<proc_macro2::TokenStream, SessionDiagnosticDeriveError> {
|
||||
let field_binding = &info.binding.binding;
|
||||
|
||||
let option_ty = option_inner_ty(&info.ty);
|
||||
let option_ty = option_inner_ty(info.ty);
|
||||
|
||||
let generated_code = self.generate_non_option_field_code(
|
||||
attr,
|
||||
FieldInfo {
|
||||
vis: info.vis,
|
||||
binding: info.binding,
|
||||
ty: option_ty.unwrap_or(&info.ty),
|
||||
ty: option_ty.unwrap_or(info.ty),
|
||||
span: info.span,
|
||||
},
|
||||
)?;
|
||||
|
@ -388,7 +388,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
|
|||
let formatted_str = self.build_format(&s.value(), attr.span());
|
||||
match name {
|
||||
"message" => {
|
||||
if type_matches_path(&info.ty, &["rustc_span", "Span"]) {
|
||||
if type_matches_path(info.ty, &["rustc_span", "Span"]) {
|
||||
quote! {
|
||||
#diag.set_span(*#field_binding);
|
||||
#diag.set_primary_message(#formatted_str);
|
||||
|
@ -401,7 +401,7 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
|
|||
}
|
||||
}
|
||||
"label" => {
|
||||
if type_matches_path(&info.ty, &["rustc_span", "Span"]) {
|
||||
if type_matches_path(info.ty, &["rustc_span", "Span"]) {
|
||||
quote! {
|
||||
#diag.span_label(*#field_binding, #formatted_str);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue