fix: resolve clippy warnings (matches!, map_or, redundant guard, unnecessary allocations)

This commit is contained in:
Nikketryhard
2026-02-14 04:06:18 -06:00
parent 725bdb4e9a
commit 901cd3d2e3
7 changed files with 14 additions and 32 deletions

View File

@@ -227,10 +227,7 @@ fn looks_like_valid_message(fields: &[ProtoField], original_len: usize) -> bool
// (e.g., a long string that happened to have a valid first-field prefix)
if fields.len() == 1 && original_len > 100 {
// Single-field messages of >100 bytes are suspicious unless the field is bytes/message
match &fields[0].value {
ProtoValue::Bytes(_) | ProtoValue::Message(_) => true,
_ => false,
}
matches!(&fields[0].value, ProtoValue::Bytes(_) | ProtoValue::Message(_))
} else {
true
}

View File

@@ -46,6 +46,7 @@ const PASSTHROUGH_DOMAINS: &[&str] = &[
];
/// Configuration for the MITM proxy.
#[derive(Default)]
pub struct MitmConfig {
/// Port to listen on (0 = auto-assign).
pub port: u16,
@@ -53,14 +54,6 @@ pub struct MitmConfig {
pub modify_requests: bool,
}
impl Default for MitmConfig {
fn default() -> Self {
Self {
port: 0,
modify_requests: false,
}
}
}
/// Run the MITM proxy server.
///
@@ -405,7 +398,7 @@ async fn handle_http_over_tls(
async fn resolve_upstream(domain: &str) -> String {
// 1. Try dig @8.8.8.8 (bypasses /etc/hosts)
if let Ok(output) = tokio::process::Command::new("dig")
.args(["+short", &format!("@8.8.8.8"), domain])
.args(["+short", "@8.8.8.8", domain])
.output()
.await
{