Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmuente committed Sep 13, 2021
1 parent 828ec46 commit 8dd7783
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.rs
@@ -1,5 +1,4 @@
use clap::{AppSettings, Clap};
use exitcode;
use std::net::TcpStream;
use std::sync::mpsc;
use std::sync::Arc;
Expand Down Expand Up @@ -105,17 +104,16 @@ fn main() {
std::process::exit(exitcode::USAGE);
}

if opts.amount_thread <= 0 {
println!("thread amount must be greater 1");
if opts.amount_thread == 0 {
println!("thread amount must be greater 0");
std::process::exit(exitcode::USAGE);
}

let pool = ThreadPool::new(opts.amount_thread);

for i in opts.from_port..opts.to_port + 1 {
let x = i.clone();
let host = opts.host.clone();
pool.execute(move || check_port(host, x as i32));
pool.execute(move || check_port(host, i as i32));
}

drop(pool);
Expand Down

0 comments on commit 8dd7783

Please sign in to comment.