From 3db8142e6d81d457d54e6e41c090b42bf3fbea4a Mon Sep 17 00:00:00 2001 From: Lukas Pustina Date: Tue, 24 Mar 2020 15:41:41 +0100 Subject: [PATCH] Clippify --- src/analyze.rs | 7 ++----- src/lib.rs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/analyze.rs b/src/analyze.rs index 6689365..fb24743 100644 --- a/src/analyze.rs +++ b/src/analyze.rs @@ -116,11 +116,8 @@ fn run_to_scanned_hosts_by_ip(nmap_run: &Run) -> BTreeMap<&IpAddr, &nmap::Host> let mut shbi = BTreeMap::new(); for host in &nmap_run.hosts { for address in &host.addresses { - match address { - Address::IpV4 { ref addr } => { - shbi.insert(addr, host); - } - _ => {} + if let Address::IpV4{ ref addr } = address { + shbi.insert(addr, host); } } } diff --git a/src/lib.rs b/src/lib.rs index 3be3640..243ea66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,8 +30,7 @@ pub use portspec::PortSpecs; use serde::de::{self, Deserialize, Deserializer}; use std::fmt::Display; -use std::fs::File; -use std::io::Read; +use std::fs; use std::path::Path; use std::str::FromStr; @@ -59,9 +58,7 @@ pub trait FromFile { ) -> ::std::result::Result { let path: &Path = path.as_ref(); - let mut file = File::open(path)?; - let mut contents = String::new(); - let _ = file.read_to_string(&mut contents)?; + let contents = fs::read_to_string(path)?; Ok(contents) }