mostly just formatting

This commit is contained in:
Lynne Megido 2021-10-06 01:41:08 +10:00
parent b5ef95b6ef
commit 58d5ac7e75
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
3 changed files with 20 additions and 3 deletions

View file

@ -9,7 +9,13 @@
//! You can view [fif's README](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#fif) to learn more. //! You can view [fif's README](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#fif) to learn more.
#![forbid(unsafe_code)] #![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 files;
pub mod findings; pub mod findings;

View file

@ -4,7 +4,13 @@
// fif - a command-line tool for detecting and optionally correcting files with incorrect extensions. // fif - a command-line tool for detecting and optionally correcting files with incorrect extensions.
#![forbid(unsafe_code)] #![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::io::{stdin, stdout, BufWriter, Write};
use std::process::exit; use std::process::exit;

View file

@ -103,7 +103,12 @@ cfg_if! {
} }
fn get_type(&self, data: &[u8]) -> Option<Mime> { 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 { } else {