From fb021d7ceff3f8b1d7cdb0c2bdd75ea07c0428d2 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 15 Mar 2023 17:46:36 -0400 Subject: refactor: remove usages of `map_or` / `map_or_else` (#18212) These methods are confusing because the arguments are backwards. I feel like they should have never been added to `Option` and that clippy should suggest rewriting to `map(...).unwrap_or(...)`/`map(...).unwrap_or_else(|| ...)` https://github.com/rust-lang/rfcs/issues/1025 --- cli/http_util.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cli/http_util.rs') diff --git a/cli/http_util.rs b/cli/http_util.rs index 9476d6a5f..b01732ca9 100644 --- a/cli/http_util.rs +++ b/cli/http_util.rs @@ -202,7 +202,8 @@ impl CacheSemantics { && self .cache_control .max_stale - .map_or(true, |val| val > self.age() - self.max_age()); + .map(|val| val > self.age() - self.max_age()) + .unwrap_or(true); if !allows_stale { return false; } -- cgit v1.2.3