cargo fmt, cargo update

This commit is contained in:
Lynne Megido 2021-10-04 01:00:49 +10:00
parent 3f40c61d6d
commit 451ea3d5d9
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
3 changed files with 7 additions and 10 deletions

4
Cargo.lock generated
View file

@ -642,9 +642,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.77" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0" checksum = "a4eac2e6c19f5c3abc0c229bea31ff0b9b091c7b14990e8924b92902a303a0c0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -24,9 +24,7 @@ pub struct Findings {
} }
impl PartialOrd<Self> for Findings { impl PartialOrd<Self> for Findings {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
Some(self.cmp(other))
}
} }
impl Ord for Findings { impl Ord for Findings {
@ -37,12 +35,12 @@ impl Ord for Findings {
// valid Findings to be equal, avoiding the (somewhat) expensive call to recommended_extension. after all, since // valid Findings to be equal, avoiding the (somewhat) expensive call to recommended_extension. after all, since
// fif never displays valid files, it really doesn't matter what position they end up in. // fif never displays valid files, it really doesn't matter what position they end up in.
if self.valid || other.valid { if self.valid || other.valid {
return Ordering::Equal return Ordering::Equal;
} }
match (self.recommended_extension(), other.recommended_extension()) { match (self.recommended_extension(), other.recommended_extension()) {
(None, Some(_)) => Ordering::Greater, (None, Some(_)) => Ordering::Greater,
(Some(_), None) => Ordering::Less, (Some(_), None) => Ordering::Less,
_ => self.file.cmp(&other.file) _ => self.file.cmp(&other.file),
} }
} }
} }

View file

@ -61,7 +61,7 @@ type Entries<'a> = [Result<Findings, ScanError<'a>>];
fn sort_entries<'a>(entries: &'a Entries) -> (Vec<&'a Findings>, Vec<&'a ScanError<'a>>) { fn sort_entries<'a>(entries: &'a Entries) -> (Vec<&'a Findings>, Vec<&'a ScanError<'a>>) {
let (mut findings, mut errors): (Vec<_>, Vec<_>) = entries.iter().partition_map(|entry| match entry { let (mut findings, mut errors): (Vec<_>, Vec<_>) = entries.iter().partition_map(|entry| match entry {
Ok(f) => Either::Left(f), Ok(f) => Either::Left(f),
Err(e) => Either::Right(e) Err(e) => Either::Right(e),
}); });
findings.sort_unstable(); findings.sort_unstable();
@ -347,7 +347,6 @@ impl Format for Json {
let (findings, errors) = &sort_entries(entries); let (findings, errors) = &sort_entries(entries);
let result = serde_json::to_writer_pretty(f, &SerdeEntries { errors, findings }); let result = serde_json::to_writer_pretty(f, &SerdeEntries { errors, findings });
if let Err(err) = result { if let Err(err) = result {