mirror of
https://github.com/whit3rabbit/anyllm-proxy.git
synced 2026-09-22 00:00:50 +00:00
style: use rsplit+find instead of filter+last to satisfy clippy
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ea3580fe2e
commit
e13610667d
@@ -530,10 +530,9 @@ pub async fn check_ip_allowlist(request: Request<Body>, next: Next) -> Result<Re
|
||||
.get("x-forwarded-for")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.and_then(|s| {
|
||||
s.split(',')
|
||||
s.rsplit(',')
|
||||
.map(|p| p.trim())
|
||||
.filter(|p| !p.is_empty())
|
||||
.last()
|
||||
.find(|p| !p.is_empty())
|
||||
})
|
||||
.and_then(|s| s.parse::<std::net::IpAddr>().ok())
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user