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:
parent
5b62672541
commit
4994ac20f9
7 changed files with 22 additions and 22 deletions
|
|
@ -312,7 +312,7 @@ impl Compound {
|
||||||
|
|
||||||
states.push(State::new_with_builder(
|
states.push(State::new_with_builder(
|
||||||
state_name.clone(),
|
state_name.clone(),
|
||||||
&builder_data_ident,
|
builder_data_ident,
|
||||||
&builder_data_ty,
|
&builder_data_ty,
|
||||||
).with_field(
|
).with_field(
|
||||||
substate_data,
|
substate_data,
|
||||||
|
|
@ -457,7 +457,7 @@ impl Compound {
|
||||||
|
|
||||||
states.push(State::new_with_builder(
|
states.push(State::new_with_builder(
|
||||||
discard_state_ident.clone(),
|
discard_state_ident.clone(),
|
||||||
&builder_data_ident,
|
builder_data_ident,
|
||||||
&builder_data_ty,
|
&builder_data_ty,
|
||||||
).with_field(
|
).with_field(
|
||||||
substate_data,
|
substate_data,
|
||||||
|
|
@ -726,7 +726,7 @@ impl Compound {
|
||||||
if self.fields.len() > 1 {
|
if self.fields.len() > 1 {
|
||||||
return None;
|
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
|
/// Construct a tuple type with this compound's field's types in the same
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ impl NameVariant {
|
||||||
}),
|
}),
|
||||||
state_ty_ident,
|
state_ty_ident,
|
||||||
&self.ident.to_string(),
|
&self.ident.to_string(),
|
||||||
&item_iter_ty_lifetime,
|
item_iter_ty_lifetime,
|
||||||
)?
|
)?
|
||||||
.with_augmented_init(|init| {
|
.with_augmented_init(|init| {
|
||||||
quote! {
|
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
|
/// `parent_name` should point at the compound which is being parsed and
|
||||||
/// `field` should be the field to which the child belongs.
|
/// `field` should be the field to which the child belongs.
|
||||||
pub(super) fn on_missing_child(parent_name: &ParentRef, field: &Member) -> String {
|
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.
|
/// 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!(
|
format!(
|
||||||
"{} must not have more than one child in {}.",
|
"{} must not have more than one child in {}.",
|
||||||
parent_name,
|
parent_name,
|
||||||
FieldName(&field)
|
FieldName(field)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,17 @@ impl Field for FlagField {
|
||||||
|
|
||||||
let unknown_attr_err = format!(
|
let unknown_attr_err = format!(
|
||||||
"Unknown attribute in flag child {} in {}.",
|
"Unknown attribute in flag child {} in {}.",
|
||||||
FieldName(&member),
|
FieldName(member),
|
||||||
container_name
|
container_name
|
||||||
);
|
);
|
||||||
let unknown_child_err = format!(
|
let unknown_child_err = format!(
|
||||||
"Unknown child in flag child {} in {}.",
|
"Unknown child in flag child {} in {}.",
|
||||||
FieldName(&member),
|
FieldName(member),
|
||||||
container_name
|
container_name
|
||||||
);
|
);
|
||||||
let unknown_text_err = format!(
|
let unknown_text_err = format!(
|
||||||
"Unexpected text in flag child {} in {}.",
|
"Unexpected text in flag child {} in {}.",
|
||||||
FieldName(&member),
|
FieldName(member),
|
||||||
container_name
|
container_name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -420,8 +420,13 @@ fn new_field(
|
||||||
})),
|
})),
|
||||||
|
|
||||||
#[cfg(not(feature = "minidom"))]
|
#[cfg(not(feature = "minidom"))]
|
||||||
XmlFieldMeta::Element { span, amount } => {
|
XmlFieldMeta::Element {
|
||||||
|
span,
|
||||||
|
amount,
|
||||||
|
default_,
|
||||||
|
} => {
|
||||||
let _ = amount;
|
let _ = amount;
|
||||||
|
let _ = default_;
|
||||||
Err(Error::new(
|
Err(Error::new(
|
||||||
span,
|
span,
|
||||||
"#[xml(element)] requires xso to be built with the \"minidom\" feature.",
|
"#[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
|
// We got a type path -- so we now inject the `::` before any `<` as
|
||||||
// needed.
|
// needed.
|
||||||
for segment in type_path.path.segments.iter_mut() {
|
for segment in type_path.path.segments.iter_mut() {
|
||||||
match segment.arguments {
|
if let PathArguments::AngleBracketed(ref mut arguments) = segment.arguments {
|
||||||
PathArguments::AngleBracketed(ref mut arguments) => {
|
let span = arguments.span();
|
||||||
let span = arguments.span();
|
arguments.colon2_token.get_or_insert(token::PathSep {
|
||||||
arguments
|
spans: [span, span],
|
||||||
.colon2_token
|
});
|
||||||
.get_or_insert_with(|| token::PathSep {
|
|
||||||
spans: [span, span],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok((
|
Ok((
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ pub(crate) fn text_codec_encode_fn(for_ty: Type) -> Expr {
|
||||||
Expr::Path(ExprPath {
|
Expr::Path(ExprPath {
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
qself: None,
|
qself: None,
|
||||||
path: path,
|
path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,7 +373,7 @@ pub(crate) fn text_codec_decode_fn(for_ty: Type) -> Expr {
|
||||||
Expr::Path(ExprPath {
|
Expr::Path(ExprPath {
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
qself: None,
|
qself: None,
|
||||||
path: path,
|
path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue