xso-proc: clippy run

Caught a bug hidden behind #[cfg(not(feature = "minidom"))]

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2025-04-07 21:04:16 +02:00
commit 4994ac20f9
7 changed files with 22 additions and 22 deletions

View file

@ -312,7 +312,7 @@ impl Compound {
states.push(State::new_with_builder(
state_name.clone(),
&builder_data_ident,
builder_data_ident,
&builder_data_ty,
).with_field(
substate_data,
@ -457,7 +457,7 @@ impl Compound {
states.push(State::new_with_builder(
discard_state_ident.clone(),
&builder_data_ident,
builder_data_ident,
&builder_data_ty,
).with_field(
substate_data,
@ -726,7 +726,7 @@ impl Compound {
if self.fields.len() > 1 {
return None;
}
self.fields.get(0).map(|x| x.ty())
self.fields.first().map(|x| x.ty())
}
/// Construct a tuple type with this compound's field's types in the same

View file

@ -136,7 +136,7 @@ impl NameVariant {
}),
state_ty_ident,
&self.ident.to_string(),
&item_iter_ty_lifetime,
item_iter_ty_lifetime,
)?
.with_augmented_init(|init| {
quote! {

View file

@ -130,7 +130,7 @@ pub(super) fn on_missing_attribute(parent_name: &ParentRef, field: &Member) -> S
/// `parent_name` should point at the compound which is being parsed and
/// `field` should be the field to which the child belongs.
pub(super) fn on_missing_child(parent_name: &ParentRef, field: &Member) -> String {
format!("Missing child {} in {}.", FieldName(&field), parent_name)
format!("Missing child {} in {}.", FieldName(field), parent_name)
}
/// Create a string error message for a duplicate child element.
@ -141,6 +141,6 @@ pub(super) fn on_duplicate_child(parent_name: &ParentRef, field: &Member) -> Str
format!(
"{} must not have more than one child in {}.",
parent_name,
FieldName(&field)
FieldName(field)
)
}

View file

@ -40,17 +40,17 @@ impl Field for FlagField {
let unknown_attr_err = format!(
"Unknown attribute in flag child {} in {}.",
FieldName(&member),
FieldName(member),
container_name
);
let unknown_child_err = format!(
"Unknown child in flag child {} in {}.",
FieldName(&member),
FieldName(member),
container_name
);
let unknown_text_err = format!(
"Unexpected text in flag child {} in {}.",
FieldName(&member),
FieldName(member),
container_name
);

View file

@ -420,8 +420,13 @@ fn new_field(
})),
#[cfg(not(feature = "minidom"))]
XmlFieldMeta::Element { span, amount } => {
XmlFieldMeta::Element {
span,
amount,
default_,
} => {
let _ = amount;
let _ = default_;
Err(Error::new(
span,
"#[xml(element)] requires xso to be built with the \"minidom\" feature.",

View file

@ -695,16 +695,11 @@ fn parse_codec_expr(p: parse::ParseStream<'_>) -> Result<(Expr, Option<Error>)>
// We got a type path -- so we now inject the `::` before any `<` as
// needed.
for segment in type_path.path.segments.iter_mut() {
match segment.arguments {
PathArguments::AngleBracketed(ref mut arguments) => {
let span = arguments.span();
arguments
.colon2_token
.get_or_insert_with(|| token::PathSep {
spans: [span, span],
});
}
_ => (),
if let PathArguments::AngleBracketed(ref mut arguments) = segment.arguments {
let span = arguments.span();
arguments.colon2_token.get_or_insert(token::PathSep {
spans: [span, span],
});
}
}
Ok((

View file

@ -358,7 +358,7 @@ pub(crate) fn text_codec_encode_fn(for_ty: Type) -> Expr {
Expr::Path(ExprPath {
attrs: Vec::new(),
qself: None,
path: path,
path,
})
}
@ -373,7 +373,7 @@ pub(crate) fn text_codec_decode_fn(for_ty: Type) -> Expr {
Expr::Path(ExprPath {
attrs: Vec::new(),
qself: None,
path: path,
path,
})
}