]> OzVa Git service - ozva-cloud/commitdiff
refactor: remove one clone on `assets_prefix` (#270)
authortieway59 <40034603+TieWay59@users.noreply.github.com>
Thu, 5 Oct 2023 00:50:24 +0000 (08:50 +0800)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 00:50:24 +0000 (08:50 +0800)
This clone is not consist with the usage of `assets_prefix` in following
code and it's unnecessary.

Signed-off-by: TieWay59 <tieway59@foxmail.com>
src/server.rs

index ec2843faf99e34055d5d42800c80e30a22c111d4..e17e33cf623c74a0f0157e78859ca69e3d0daa2f 100644 (file)
@@ -96,7 +96,7 @@ impl Server {
         addr: Option<SocketAddr>,
     ) -> Result<Response, hyper::Error> {
         let uri = req.uri().clone();
-        let assets_prefix = self.assets_prefix.clone();
+        let assets_prefix = &self.assets_prefix;
         let enable_cors = self.args.enable_cors;
         let mut http_log_data = self.args.log_http.data(&req, &self.args);
         if let Some(addr) = addr {
@@ -106,7 +106,7 @@ impl Server {
         let mut res = match self.clone().handle(req).await {
             Ok(res) => {
                 http_log_data.insert("status".to_string(), res.status().as_u16().to_string());
-                if !uri.path().starts_with(&assets_prefix) {
+                if !uri.path().starts_with(assets_prefix) {
                     self.args.log_http.log(&http_log_data, None);
                 }
                 res