Applied clippy fixes

This commit is contained in:
AB
2025-12-01 01:48:36 +02:00
parent 1249d15aad
commit 1a4a296fae
15 changed files with 78 additions and 85 deletions

View File

@@ -7,25 +7,19 @@ pub struct InboundGenerationOptions {
pub fn generate_inbound_config(options: InboundGenerationOptions) -> Vec<config_models::Inbound> {
let mut inbounds: Vec<config_models::Inbound> = vec![];
match options.socks_port {
Some(port) => {
inbounds.push(generate_socks_inbound(port));
}
None => {}
if let Some(port) = options.socks_port {
inbounds.push(generate_socks_inbound(port));
}
match options.http_port {
Some(port) => {
inbounds.push(generate_http_inbound(port));
}
None => {}
if let Some(port) = options.http_port {
inbounds.push(generate_http_inbound(port));
}
return inbounds;
inbounds
}
pub fn generate_http_inbound(http_port: u16) -> config_models::Inbound {
return config_models::Inbound {
config_models::Inbound {
protocol: String::from("http"),
port: http_port,
tag: String::from("http-in"),
@@ -42,11 +36,11 @@ pub fn generate_http_inbound(http_port: u16) -> config_models::Inbound {
String::from("quic"),
]),
}),
};
}
}
pub fn generate_socks_inbound(socks_port: u16) -> config_models::Inbound {
return config_models::Inbound {
config_models::Inbound {
protocol: String::from("socks"),
port: socks_port,
tag: String::from("socks-in"),
@@ -63,5 +57,5 @@ pub fn generate_socks_inbound(socks_port: u16) -> config_models::Inbound {
String::from("quic"),
]),
}),
};
}
}