Applied clippy fixes

This commit is contained in:
AB
2025-12-01 01:52:06 +02:00
parent 7c741c8e62
commit 67fe482a7c
3 changed files with 5 additions and 12 deletions

View File

@@ -21,13 +21,13 @@ pub fn get_metadata(uri: &str) -> String {
port: data.port, port: data.port,
protocol, protocol,
}; };
serde_json::to_string(&meta_data).unwrap() serde_json::to_string(&meta_data).unwrap()
} }
pub fn create_json_config(uri: &str, socks_port: Option<u16>, http_port: Option<u16>) -> String { pub fn create_json_config(uri: &str, socks_port: Option<u16>, http_port: Option<u16>) -> String {
let config = create_config(uri, socks_port, http_port); let config = create_config(uri, socks_port, http_port);
serde_json::to_string(&config).unwrap() serde_json::to_string(&config).unwrap()
} }
@@ -42,7 +42,7 @@ pub fn create_config(
socks_port, socks_port,
http_port, http_port,
}); });
config_models::Config { config_models::Config {
outbounds: vec![outbound_object], outbounds: vec![outbound_object],
inbounds: inbound_config, inbounds: inbound_config,
@@ -56,8 +56,6 @@ pub fn create_outbound_object(uri: &str) -> config_models::Outbound {
let allow_insecure = data.allowInsecure == Some(String::from("true")) let allow_insecure = data.allowInsecure == Some(String::from("true"))
|| data.allowInsecure == Some(String::from("1")); || data.allowInsecure == Some(String::from("1"));
Outbound { Outbound {
protocol: name, protocol: name,
tag: String::from("proxy"), tag: String::from("proxy"),

View File

@@ -8,9 +8,7 @@ use serde_json::Value;
pub fn get_data(uri: &str) -> RawData { pub fn get_data(uri: &str) -> RawData {
let data = uri.split_once("vmess://").unwrap().1; let data = uri.split_once("vmess://").unwrap().1;
match general_purpose::STANDARD match general_purpose::STANDARD.decode(url_decode_str(data).unwrap_or(String::from(data))) {
.decode(url_decode_str(data).unwrap_or(String::from(data)))
{
Ok(decoded) => get_raw_data_from_base64(&decoded), Ok(decoded) => get_raw_data_from_base64(&decoded),
Err(_) => get_raw_data_from_uri(data), Err(_) => get_raw_data_from_uri(data),
} }

View File

@@ -24,8 +24,5 @@ pub fn parse_raw_json(input: &str) -> Option<serde_json::Value> {
} }
pub fn get_parameter_value(query: &Vec<(&str, &str)>, param: &str) -> Option<String> { pub fn get_parameter_value(query: &Vec<(&str, &str)>, param: &str) -> Option<String> {
query query.iter().find(|q| q.0 == param).map(|q| q.1.to_string())
.iter()
.find(|q| q.0 == param)
.map(|q| q.1.to_string())
} }