Clippy run

This commit is contained in:
Luke D. Jones
2022-09-30 15:10:56 +13:00
parent 8569edf684
commit 600d0ae3d9
39 changed files with 252 additions and 251 deletions

View File

@@ -51,7 +51,7 @@ pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<(
pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
if let Some(value) = device.attribute_value(attr_name) {
let tmp = value.to_string_lossy();
return Ok(tmp.parse::<u8>().map_err(|_| PlatformError::ParseNum)?);
return tmp.parse::<u8>().map_err(|_| PlatformError::ParseNum);
}
Err(PlatformError::AttrNotFound(attr_name.to_string()))
}
@@ -67,7 +67,7 @@ pub fn read_attr_u8_array(device: &Device, attr_name: &str) -> Result<Vec<u8>> {
let tmp = value.to_string_lossy();
let tmp = tmp
.split(' ')
.map(|v| u8::from_str_radix(v, 10).unwrap_or(0))
.map(|v| v.parse::<u8>().unwrap_or(0))
.collect();
return Ok(tmp);
}
@@ -94,7 +94,7 @@ mod tests {
let tmp: Vec<u8> = tmp
.split(' ')
.map(|v| u8::from_str_radix(v, 10).unwrap_or(0))
.map(|v| v.parse::<u8>().unwrap_or(0))
.collect();
assert_eq!(tmp, &[1, 2, 3, 4, 5]);
}