removed an unecessary allocation
Some checks failed
continuous-integration/drone/push Build is failing

you know what they say, premature optimisation is the best optimisation
This commit is contained in:
Lynne Megido 2021-03-12 02:55:40 +10:00
parent b09b871b3d
commit 6d55b3c309
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
2 changed files with 6 additions and 3 deletions

4
rustfmt.toml Normal file
View file

@ -0,0 +1,4 @@
max_width = 120
hard_tabs = true
tab_spaces = 2
newline_style = "Unix"

View file

@ -1,7 +1,6 @@
use std::path::PathBuf;
use mime_guess::Mime;
use smartstring::alias::String;
use crate::inspectors::mime_extension_lookup;
@ -16,7 +15,7 @@ pub struct Findings {
}
impl Findings {
pub fn recommended_extension(&self) -> Option<String> {
mime_extension_lookup(self.mime.clone()).map(|extensions| extensions[0].to_owned())
pub fn recommended_extension(&self) -> Option<&str> {
mime_extension_lookup(self.mime.clone()).map(|extensions| &*extensions[0])
}
}