Detailed changes
@@ -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
@@ -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! {
@@ -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)
)
}
@@ -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
);
@@ -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.",
@@ -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((
@@ -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,
})
}