From 4b058ba43b33cca1dde37416b8d4e8dbf04566cb Mon Sep 17 00:00:00 2001 From: Shell Chen Date: Tue, 7 Dec 2021 15:36:21 +0800 Subject: [PATCH] Make clippy happy somewhat --- src/proxy/mod.rs | 1 + src/web/rich.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/proxy/mod.rs b/src/proxy/mod.rs index 82c5cbd..7e19f06 100644 --- a/src/proxy/mod.rs +++ b/src/proxy/mod.rs @@ -65,6 +65,7 @@ impl UserPassAuthCredential { } } +#[allow(clippy::mutable_key_type)] #[derive(Debug, Serialize)] pub struct ProxyServer { pub addr: SocketAddr, diff --git a/src/web/rich.rs b/src/web/rich.rs index e0b8e8d..57b7249 100644 --- a/src/web/rich.rs +++ b/src/web/rich.rs @@ -27,7 +27,7 @@ impl ResourceBundle { file.read_to_end(&mut content) .expect("error on read moproxy-web bundle"); - let name_ext = name.rsplitn(2, '.').next(); + let name_ext = name.rsplit_once('.').map(|x| x.1); let mime = match name_ext { Some("html") => "text/html", Some("js") => "application/javascript",