Browse Source

cargo fmt

edition-2021
Lynne Megido 3 months ago
parent
commit
fb81f26ff5
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
  1. 14
      src/files.rs
  2. 10
      src/lib.rs
  3. 7
      src/main.rs
  4. 7
      src/tests/mod.rs

14
src/files.rs

@ -1,12 +1,12 @@
use log::{debug, error};
use cfg_if::cfg_if;
use walkdir::{DirEntry, WalkDir};
use std::collections::BTreeSet;
use crate::parameters::ScanOpts;
use mime_guess::from_ext;
use crate::findings::{Findings, ScanError};
use crate::parameters::ScanOpts;
use crate::{inspectors, MIMEDB};
use cfg_if::cfg_if;
use log::{debug, error};
use mime_guess::from_ext;
use std::collections::BTreeSet;
use std::path::Path;
use walkdir::{DirEntry, WalkDir};
cfg_if! {
if #[cfg(windows)] {
@ -195,4 +195,4 @@ pub fn scan_directory(
} else {
Some(entries)
}
}
}

10
src/lib.rs

@ -1,19 +1,19 @@
#![forbid(unsafe_code)]
#![warn(trivial_casts, unused_lifetimes, unused_qualifications)]
pub mod mime_db;
pub mod files;
pub mod findings;
pub mod formats;
pub mod inspectors;
pub mod mime_db;
pub mod parameters;
pub mod string_type;
pub mod utils;
pub mod files;
use cfg_if::cfg_if;
use once_cell::sync::OnceCell;
use crate::findings::Findings;
use crate::mime_db::MimeDb;
use cfg_if::cfg_if;
use once_cell::sync::OnceCell;
cfg_if! {
if #[cfg(any(all(unix, feature = "infer-backend"), all(not(unix), not(feature = "xdg-mime-backend"))))] {
@ -40,4 +40,4 @@ pub fn init_db() {
.unwrap();
}
}
}
}

7
src/main.rs

@ -23,11 +23,11 @@ use std::process::exit;
use clap::Clap;
use log::{debug, error, info, trace, warn, Level};
use fif::files::{scan_directory, scan_from_walkdir};
use fif::formats::Format;
use fif::parameters::{OutputFormat};
use fif::parameters::OutputFormat;
use fif::utils::{clap_long_version, os_name};
use fif::{init_db, parameters, formats};
use fif::files::{scan_directory, scan_from_walkdir};
use fif::{formats, init_db, parameters};
#[cfg(test)]
mod tests;
@ -142,4 +142,3 @@ fn main() {
debug!("Done");
}

7
src/tests/mod.rs

@ -1,9 +1,9 @@
use fif::files::{scan_directory, scan_from_walkdir};
use fif::findings::Findings;
use fif::formats::{Format, PowerShell, Shell};
use fif::inspectors::{mime_extension_lookup, BUF_SIZE};
use fif::mime_db::MimeDb;
use fif::string_type::String;
use fif::files::{scan_directory, scan_from_walkdir};
use crate::parameters::Parameters;
use clap::Clap;
@ -333,10 +333,7 @@ fn identify_random_bytes() {
for (mime, count) in &results {
println!("{}:\t{} counts", mime, count);
}
println!(
"No type found:\t{} counts",
1000 - results.values().sum::<i32>()
);
println!("No type found:\t{} counts", 1000 - results.values().sum::<i32>());
}
#[test]

Loading…
Cancel
Save