Browse Source

mostly just formatting

master
Lynne Megido 2 months ago
parent
commit
58d5ac7e75
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
  1. 8
      src/lib.rs
  2. 8
      src/main.rs
  3. 7
      src/mime_db.rs

8
src/lib.rs

@ -9,7 +9,13 @@
//! You can view [fif's README](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#fif) to learn more.
#![forbid(unsafe_code)]
#![warn(trivial_casts, unused_lifetimes, unused_qualifications, missing_copy_implementations, unused_allocation)]
#![warn(
trivial_casts,
unused_lifetimes,
unused_qualifications,
missing_copy_implementations,
unused_allocation
)]
pub mod files;
pub mod findings;

8
src/main.rs

@ -4,7 +4,13 @@
// fif - a command-line tool for detecting and optionally correcting files with incorrect extensions.
#![forbid(unsafe_code)]
#![warn(trivial_casts, unused_lifetimes, unused_qualifications, missing_copy_implementations, unused_allocation)]
#![warn(
trivial_casts,
unused_lifetimes,
unused_qualifications,
missing_copy_implementations,
unused_allocation
)]
use std::io::{stdin, stdout, BufWriter, Write};
use std::process::exit;

7
src/mime_db.rs

@ -103,7 +103,12 @@ cfg_if! {
}
fn get_type(&self, data: &[u8]) -> Option<Mime> {
self.db.get(data).map(|f| Mime::from_str(f.mime_type())).ok()
if let Some(mime) = self.db.get(data) {
match Mime::from_str(mime.mime_type()) {
Err(_) => None,
Ok(m) => Some(m),
}
} else { None }
}
}
} else {

Loading…
Cancel
Save