clippy: misc. fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 11:37:49 +01:00
parent 3f48cdb380
commit ea368a06cd
14 changed files with 23 additions and 28 deletions

View File

@ -144,6 +144,6 @@ fn correct_byte_convert() {
assert_eq!(convert(1023), "1023 B");
assert_eq!(convert(1<<10), "1.00 KiB");
assert_eq!(convert(1<<20), "1.00 MiB");
assert_eq!(convert((1<<30) + (103 * 1<<20)), "1.10 GiB");
assert_eq!(convert((2<<50) + (500 * 1<<40)), "2.49 PiB");
assert_eq!(convert((1<<30) + 103 * (1<<20)), "1.10 GiB");
assert_eq!(convert((2<<50) + 500 * (1<<40)), "2.49 PiB");
}

View File

@ -29,7 +29,7 @@ pub fn write_canonical_json(value: &Value, output: &mut Vec<u8>) -> Result<(), E
Value::Object(map) => {
output.push(b'{');
let mut keys: Vec<&str> = map.keys().map(String::as_str).collect();
keys.sort();
keys.sort_unstable();
let mut iter = keys.into_iter();
if let Some(key) = iter.next() {
serde_json::to_writer(&mut *output, &key)?;

View File

@ -49,7 +49,7 @@ impl DateTimeValue {
}
pub fn list_contains(list: &[DateTimeValue], value: u32) -> bool {
list.iter().find(|spec| spec.contains(value)).is_some()
list.iter().any(|spec| spec.contains(value))
}
// Find an return an entry greater than value