Skip to content

Commit

Permalink
Clippify
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspustina committed Jul 28, 2018
1 parent e04fdf6 commit a43c9e1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ pub fn default_analysis<'a>(nmap_run: &'a Run, mapping: &'a Mapping, portspecs:
let mut error = 0;
for ar in &analysis_results {
match ar.result {
AnalysisResult::Pass => {pass = pass + 1;},
AnalysisResult::Fail => {fail = fail + 1;},
AnalysisResult::Error{ reason: _ } => {error = error + 1;},
AnalysisResult::Pass => {pass += 1;},
AnalysisResult::Fail => {fail += 1;},
AnalysisResult::Error{ .. } => {error += 1;},
}
}
let result = AnalyzerResult {

AnalyzerResult {
pass,
fail,
error,
analysis_results,
};

result
}
}

#[derive(Debug, Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn run_nmap_analyze<T: AsRef<Path>>(nmap_file: T, mapping_file: T, portspecs_fil
let nmap_run = Run::from_file(nmap_file.as_ref())
.chain_err(|| ErrorKind::InvalidFile)?;
info!("Checking nmap sanity");
let _ = nmap_run.is_sane()
nmap_run.is_sane()
.chain_err(|| ErrorKind::InvalidFile)?;

info!("Analyzing");
Expand Down
2 changes: 1 addition & 1 deletion src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn analysis_result_to_cell(result: &AnalysisResult) -> Cell {
match result {
AnalysisResult::Pass => Cell::new("Pass").with_style(Attr::ForegroundColor(color::GREEN)),
AnalysisResult::Fail => Cell::new("Fail").with_style(Attr::ForegroundColor(color::RED)),
AnalysisResult::Error{ reason: _ } => Cell::new("Error").with_style(Attr::ForegroundColor(color::RED)),
AnalysisResult::Error{ .. } => Cell::new("Error").with_style(Attr::ForegroundColor(color::RED)),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/use_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn run_nmap_analyze_human_failed_output() {
let portspecs = PortSpecs::from_file("tests/portspecs.yml").expect("Failed to load portspecs file");
let mapping = Mapping::from_file("tests/portspec_mapping.json").expect("Failed to mappings file");
let nmap_run = Run::from_file("tests/nmap-dd_all_ports.xml").expect("Failed to load nmap file");
let _ = nmap_run.is_sane().expect("Nmap file is not sane");
nmap_run.is_sane().expect("Nmap file is not sane");

let analyzer_result = default_analysis(&nmap_run, &mapping, &portspecs);

Expand Down

0 comments on commit a43c9e1

Please sign in to comment.