Browse Source

cargo fmt, cargo update

master
Lynne Megido 2 months ago
parent
commit
451ea3d5d9
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
  1. 4
      Cargo.lock
  2. 10
      src/findings.rs
  3. 3
      src/formats.rs

4
Cargo.lock generated

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

10
src/findings.rs

@ -24,9 +24,7 @@ pub struct Findings {
}
impl PartialOrd<Self> for Findings {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
}
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
// fif never displays valid files, it really doesn't matter what position they end up in.
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,
(Some(_), None) => Ordering::Less,
_ => self.file.cmp(&other.file)
_ => self.file.cmp(&other.file),
}
}
}

3
src/formats.rs

@ -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>>) {
let (mut findings, mut errors): (Vec<_>, Vec<_>) = entries.iter().partition_map(|entry| match entry {
Ok(f) => Either::Left(f),
Err(e) => Either::Right(e)
Err(e) => Either::Right(e),
});
findings.sort_unstable();
@ -347,7 +347,6 @@ impl Format for Json {
let (findings, errors) = &sort_entries(entries);
let result = serde_json::to_writer_pretty(f, &SerdeEntries { errors, findings });
if let Err(err) = result {

Loading…
Cancel
Save