refactor: remove one clone on assets_prefix (#270)

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>
This commit is contained in:
tieway59 2023-10-05 08:50:24 +08:00 committed by GitHub
parent 60df3b473c
commit 53c9bc8bea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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