mirror of
https://github.com/YGGverse/yps.git
synced 2026-03-31 08:55:28 +00:00
apply clippy optimizations
This commit is contained in:
parent
796b5bf4e8
commit
a4f82e8bbc
1 changed files with 9 additions and 10 deletions
19
src/main.rs
19
src/main.rs
|
|
@ -64,17 +64,16 @@ fn crawl(
|
|||
for (host, peers) in p.response.unwrap() {
|
||||
for port in &config.port {
|
||||
let address = SocketAddr::new(IpAddr::V6(host), *port);
|
||||
if let Some(index) = tcp {
|
||||
if !index.contains(&address) {
|
||||
let url = format!("tcp://{address}");
|
||||
if TcpStream::connect_timeout(&address, Duration::from_secs(1)).is_ok()
|
||||
{
|
||||
println!("\t{}: {url}", SUCCESS.green())
|
||||
} else if config.debug {
|
||||
println!("\t{}: {url}", FAILURE.red());
|
||||
}
|
||||
index.push(address)
|
||||
if let Some(index) = tcp
|
||||
&& !index.contains(&address)
|
||||
{
|
||||
let url = format!("tcp://{address}");
|
||||
if TcpStream::connect_timeout(&address, Duration::from_secs(1)).is_ok() {
|
||||
println!("\t{}: {url}", SUCCESS.green())
|
||||
} else if config.debug {
|
||||
println!("\t{}: {url}", FAILURE.red());
|
||||
}
|
||||
index.push(address)
|
||||
}
|
||||
if let Some((index, server)) = udp {
|
||||
let url = format!("udp://{address}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue