From 4356cab33c03e0e4761cfb01b84e87284928ea67 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 3 Jul 2024 11:15:33 +0200 Subject: [PATCH] xso-proc: Fix all clippy warnings --- xso-proc/src/compound.rs | 4 ++-- xso-proc/src/error_message.rs | 2 +- xso-proc/src/field.rs | 5 +---- xso-proc/src/meta.rs | 4 ++-- xso-proc/src/structs.rs | 4 ++-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/xso-proc/src/compound.rs b/xso-proc/src/compound.rs index 128aa8c..41c12fe 100644 --- a/xso-proc/src/compound.rs +++ b/xso-proc/src/compound.rs @@ -97,7 +97,7 @@ impl Compound { for field in self.fields.iter() { let member = field.member(); let builder_field_name = mangle_member(member); - let part = field.make_builder_part(&scope, &output_name)?; + let part = field.make_builder_part(&scope, output_name)?; match part { FieldBuilderPart::Init { @@ -174,7 +174,7 @@ impl Compound { states.push(State::new_with_builder( default_state_ident.clone(), - &builder_data_ident, + builder_data_ident, &builder_data_ty, ).with_impl(quote! { match ev { diff --git a/xso-proc/src/error_message.rs b/xso-proc/src/error_message.rs index b2913b5..0c32db8 100644 --- a/xso-proc/src/error_message.rs +++ b/xso-proc/src/error_message.rs @@ -75,7 +75,7 @@ impl fmt::Display for FieldName<'_> { pub(super) fn on_missing_attribute(parent_name: &ParentRef, field: &Member) -> String { format!( "Required attribute {} on {} missing.", - FieldName(&field), + FieldName(field), parent_name ) } diff --git a/xso-proc/src/field.rs b/xso-proc/src/field.rs index e502613..04a0358 100644 --- a/xso-proc/src/field.rs +++ b/xso-proc/src/field.rs @@ -350,9 +350,6 @@ impl FieldDef { /// Return true if this field's parsing consumes text data. pub(crate) fn is_text_field(&self) -> bool { - match self.kind { - FieldKind::Text { .. } => true, - _ => false, - } + matches!(self.kind, FieldKind::Text { .. }) } } diff --git a/xso-proc/src/meta.rs b/xso-proc/src/meta.rs index 2a88020..0b5fee4 100644 --- a/xso-proc/src/meta.rs +++ b/xso-proc/src/meta.rs @@ -16,9 +16,9 @@ use syn::{meta::ParseNestedMeta, spanned::Spanned, *}; use rxml_validation::NcName; /// XML core namespace URI (for the `xml:` prefix) -pub const XMLNS_XML: &'static str = "http://www.w3.org/XML/1998/namespace"; +pub const XMLNS_XML: &str = "http://www.w3.org/XML/1998/namespace"; /// XML namespace URI (for the `xmlns:` prefix) -pub const XMLNS_XMLNS: &'static str = "http://www.w3.org/2000/xmlns/"; +pub const XMLNS_XMLNS: &str = "http://www.w3.org/2000/xmlns/"; /// Value for the `#[xml(namespace = ..)]` attribute. #[derive(Debug)] diff --git a/xso-proc/src/structs.rs b/xso-proc/src/structs.rs index 0de95ee..5242cef 100644 --- a/xso-proc/src/structs.rs +++ b/xso-proc/src/structs.rs @@ -118,7 +118,7 @@ impl StructDef { .compile() .render( vis, - &builder_ty_ident, + builder_ty_ident, &state_ty_ident, &TypePath { qself: None, @@ -165,7 +165,7 @@ impl StructDef { } .into(), &state_ty_ident, - &event_iter_ty_ident, + event_iter_ty_ident, )?; Ok(IntoXmlParts {