parsers: clippy
Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
parent
00b638fc38
commit
e95f884e44
5 changed files with 8 additions and 7 deletions
|
|
@ -123,6 +123,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
||||||
- Implement Default for Tune
|
- Implement Default for Tune
|
||||||
- Re-export xso::error::FromElementError.
|
- Re-export xso::error::FromElementError.
|
||||||
- Fix a few tests behind 'component' feature
|
- Fix a few tests behind 'component' feature
|
||||||
|
- Fix some Clippy warnings
|
||||||
|
|
||||||
Version 0.21.0:
|
Version 0.21.0:
|
||||||
2024-07-25 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
2024-07-25 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ fn compute_identities(identities: &[Identity]) -> Vec<u8> {
|
||||||
fn compute_extensions(extensions: &[DataForm]) -> Vec<u8> {
|
fn compute_extensions(extensions: &[DataForm]) -> Vec<u8> {
|
||||||
compute_items(extensions, |extension| {
|
compute_items(extensions, |extension| {
|
||||||
// TODO: maybe handle the error case?
|
// TODO: maybe handle the error case?
|
||||||
let mut bytes = if let Some(ref form_type) = extension.form_type() {
|
let mut bytes = if let Some(form_type) = extension.form_type() {
|
||||||
form_type.as_bytes().to_vec()
|
form_type.as_bytes().to_vec()
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,11 @@ generate_attribute!(
|
||||||
|
|
||||||
fn validate_field(field: &mut Field) -> Result<(), Error> {
|
fn validate_field(field: &mut Field) -> Result<(), Error> {
|
||||||
if field.type_ != FieldType::Fixed && field.var.is_none() {
|
if field.type_ != FieldType::Fixed && field.var.is_none() {
|
||||||
return Err(Error::Other("Required attribute 'var' missing.").into());
|
return Err(Error::Other("Required attribute 'var' missing."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if !field.is_list() && field.options.len() > 0 {
|
if !field.is_list() && field.options.len() > 0 {
|
||||||
return Err(Error::Other("Option element found in non-list field.").into());
|
return Err(Error::Other("Option element found in non-list field."));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -239,7 +239,7 @@ fn patch_form(form: &mut DataForm) -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if field.values.len() != 1 {
|
if field.values.len() != 1 {
|
||||||
return Err(Error::Other("Wrong number of values in FORM_TYPE.").into());
|
return Err(Error::Other("Wrong number of values in FORM_TYPE."));
|
||||||
}
|
}
|
||||||
|
|
||||||
form_type_index = Some(i);
|
form_type_index = Some(i);
|
||||||
|
|
@ -274,7 +274,7 @@ impl DataForm {
|
||||||
pub fn form_type(&self) -> Option<&str> {
|
pub fn form_type(&self) -> Option<&str> {
|
||||||
for field in self.fields.iter() {
|
for field in self.fields.iter() {
|
||||||
if field.is_form_type(&self.type_) {
|
if field.is_form_type(&self.type_) {
|
||||||
return field.values.get(0).map(|x| x.as_str());
|
return field.values.first().map(|x| x.as_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ fn compute_extensions(extensions: &[DataForm]) -> Result<Vec<u8>, Error> {
|
||||||
Ok(compute_items(extensions, 0x1c, |extension| {
|
Ok(compute_items(extensions, 0x1c, |extension| {
|
||||||
let mut bytes = compute_item("FORM_TYPE");
|
let mut bytes = compute_item("FORM_TYPE");
|
||||||
bytes.append(&mut compute_item(
|
bytes.append(&mut compute_item(
|
||||||
if let Some(ref form_type) = extension.form_type() {
|
if let Some(form_type) = extension.form_type() {
|
||||||
form_type
|
form_type
|
||||||
} else {
|
} else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ impl DerefMut for Lang {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Lang {
|
impl fmt::Display for Lang {
|
||||||
fn fmt<'f>(&self, f: &'f mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt::Display::fmt(&self.0, f)
|
fmt::Display::fmt(&self.0, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue