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 --- ext/http/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/http') diff --git a/ext/http/lib.rs b/ext/http/lib.rs index 31b76cf44..11bd91aa4 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -553,7 +553,11 @@ fn req_url( .to_string(), ), }; - let path = req.uri().path_and_query().map_or("/", |p| p.as_str()); + let path = req + .uri() + .path_and_query() + .map(|p| p.as_str()) + .unwrap_or("/"); [scheme, "://", &host, path].concat() } -- cgit v1.2.3