From 412ca4e53890761467de233cf0ed37bebbc8eeac Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sat, 12 Aug 2023 13:58:28 -0700 Subject: [PATCH] cargo fmt --- images/src/main.rs | 2 +- tatoeba/src/main.rs | 7 +++++-- utils/src/error.rs | 5 +++-- utils/src/is_human.rs | 8 ++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/images/src/main.rs b/images/src/main.rs index c91ca54..00d18c7 100644 --- a/images/src/main.rs +++ b/images/src/main.rs @@ -10,7 +10,7 @@ pub const BING: &str = "https://www.bing.com/images/search"; #[command(author, version, about, long_about = None)] struct Args { /// The port at which to run. - #[arg(short, long, default_value_t=3002)] + #[arg(short, long, default_value_t = 3002)] port: u16, } diff --git a/tatoeba/src/main.rs b/tatoeba/src/main.rs index 2fe39ec..630091d 100644 --- a/tatoeba/src/main.rs +++ b/tatoeba/src/main.rs @@ -1,4 +1,7 @@ -use utils::{error::{Error, Result}, is_human}; +use utils::{ + error::{Error, Result}, + is_human, +}; use actix_web::{get, http::header, App, HttpRequest, HttpResponse, HttpServer, Responder}; use clap::Parser; @@ -9,7 +12,7 @@ pub const TATOEBA_API: &str = "https://tatoeba.org/en/api_v0/search"; #[command(author, version, about, long_about = None)] struct Args { /// The port at which to run. - #[arg(short, long, default_value_t=3001)] + #[arg(short, long, default_value_t = 3001)] port: u16, } diff --git a/utils/src/error.rs b/utils/src/error.rs index 992ff53..b248336 100644 --- a/utils/src/error.rs +++ b/utils/src/error.rs @@ -11,7 +11,9 @@ pub type Result = std::result::Result; pub enum Error { Reqwest(reqwest::Error), #[cfg(feature = "nothuman")] - NotHuman { target: String }, + NotHuman { + target: String, + }, } impl Display for Error { @@ -45,4 +47,3 @@ impl ResponseError for Error { }) } } - diff --git a/utils/src/is_human.rs b/utils/src/is_human.rs index b9ba6eb..eef95b9 100644 --- a/utils/src/is_human.rs +++ b/utils/src/is_human.rs @@ -12,10 +12,6 @@ pub fn is_human(request: &HttpRequest) -> bool { .headers() .get(header::USER_AGENT) .and_then(|header| header.to_str().ok()) - .map(|ua| { - HUMANS - .iter() - .any(|&human| ua.contains(human)) - }) + .map(|ua| HUMANS.iter().any(|&human| ua.contains(human))) .unwrap_or(false) -} \ No newline at end of file +}