diff --git a/src/lib.rs b/src/lib.rs index 4e12765..8757693 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,7 +66,7 @@ impl UrlShortener { let kv_result = ctx .kv("KV")? - .put(&req_body.key.replace(" ", "-"), &req_body.url); + .put(&req_body.key.replace(' ', "-"), &req_body.url); if let Ok(kv_result) = kv_result { let kv_result = kv_result.execute().await; @@ -94,7 +94,7 @@ impl UrlShortener { let req_body: Result = req.json().await; if let Ok(req_body) = req_body { - let kv_result = ctx.kv("KV")?.delete(&req_body.key.replace(" ", "-")).await; + let kv_result = ctx.kv("KV")?.delete(&req_body.key.replace(' ', "-")).await; if kv_result.is_ok() { return Response::from_html("Key Successfully Deleted"); diff --git a/src/utils.rs b/src/utils.rs index b35ba7c..65881e4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,7 +7,7 @@ pub fn log_request(req: &Request) { Date::now().to_string(), req.path(), req.cf().coordinates().unwrap_or_default(), - req.cf().region().unwrap_or("unknown region".into()) + req.cf().region().unwrap_or_else(|| "unknown region".into()) ); }