diff --git a/example/proxy/src/main.rs b/example/proxy/src/main.rs index 7763f0c..0d6a92d 100644 --- a/example/proxy/src/main.rs +++ b/example/proxy/src/main.rs @@ -129,19 +129,16 @@ fn paths_match(ref_path: &str, req_path: &str) -> bool { let mut ref_iter = ref_path.split('/'); let mut req_iter = req_path.split('/'); loop { - let ref_seg_opt = ref_iter.next(); - let req_seg_opt = req_iter.next(); - if ref_seg_opt.is_none() != req_seg_opt.is_none() { - return false; - } - if let Some(ref_seg) = ref_seg_opt { - if let Some(req_seg) = req_seg_opt { - if ref_seg.starts_with('{') || ref_seg == req_seg { - continue; + match (ref_iter.next(), req_iter.next()) { + (None, None) => return true, + (Some(ref_seg), Some(req_seg)) => { + if ref_seg.starts_with('{') || ref_seg == req_seg { + continue; + } + return false; } - return false; - }} - return true; + _ => return false, + } } } diff --git a/riven/src/req/rate_limit.rs b/riven/src/req/rate_limit.rs index b0a60af..743feab 100644 --- a/riven/src/req/rate_limit.rs +++ b/riven/src/req/rate_limit.rs @@ -169,9 +169,7 @@ impl RateLimit { let count_header_opt = headers.get(self.rate_limit_type.count_header()) .map(|h| h.to_str().expect("Failed to read count header as string.")); - // https://github.com/rust-lang/rust/issues/53667 - if let Some(limit_header) = limit_header_opt { - if let Some(count_header) = count_header_opt { + if let (Some(limit_header), Some(count_header)) = (limit_header_opt, count_header_opt) { { let buckets = self.buckets.upgradable_read(); if !buckets_require_updating(limit_header, &*buckets) { @@ -184,7 +182,7 @@ impl RateLimit { } // Notify waiters that buckets have updated (after unlocking). self.update_notify.notify_waiters(); - }} + } } }