From a89f2be37bc0e799bdb6a8a10ffd6bdf8828bafc Mon Sep 17 00:00:00 2001 From: epi Date: Thu, 8 Oct 2020 20:43:24 -0500 Subject: [PATCH] fmt / clippy --- src/scanner.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/scanner.rs b/src/scanner.rs index a2e9502..4e36d5e 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -6,6 +6,7 @@ use crate::utils::{ use crate::{heuristics, progress}; use futures::future::{BoxFuture, FutureExt}; use futures::{stream, StreamExt}; +use lazy_static::lazy_static; use reqwest::{Response, Url}; use std::collections::HashSet; use std::convert::TryInto; @@ -16,7 +17,6 @@ use tokio::fs; use tokio::io::{self, AsyncWriteExt}; use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; use tokio::task::JoinHandle; -use lazy_static::lazy_static; static CALL_COUNT: AtomicUsize = AtomicUsize::new(0); @@ -129,12 +129,16 @@ async fn spawn_terminal_reporter(mut report_channel: UnboundedReceiver /// /// If `SCANNED_URLS` did not already contain the url, return true; otherwise return false fn add_url_to_list_of_scanned_urls(resp: &str, scanned_urls: &RwLock>) -> bool { - log::trace!("enter: add_url_to_list_of_scanned_urls({}, {:?})", resp, scanned_urls); + log::trace!( + "enter: add_url_to_list_of_scanned_urls({}, {:?})", + resp, + scanned_urls + ); - return match scanned_urls.write() { + match scanned_urls.write() { // check new url against what's already been scanned Ok(mut urls) => { - let normalized_url = if resp.ends_with("/") { + let normalized_url = if resp.ends_with('/') { // append a / to the list of 'seen' urls, this is to prevent the case where // 3xx and 2xx duplicate eachother resp.to_string() @@ -156,7 +160,6 @@ fn add_url_to_list_of_scanned_urls(resp: &str, scanned_urls: &RwLock::new()); let url = "http://unknown_url"; - assert_eq!(urls.write().unwrap().insert("http://unknown_url/".to_string()), true); + assert_eq!( + urls.write() + .unwrap() + .insert("http://unknown_url/".to_string()), + true + ); assert_eq!(add_url_to_list_of_scanned_urls(url, &urls), false); }