From c093b28e4dc48c5b60792dcc76d83dcf068015b1 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Wed, 5 Oct 2022 18:31:20 +0200 Subject: net: use Option::and_then instead of .map and .flatten More idiomatic this way. Sponsored-by: pep.foundation --- net/src/wkd.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net/src/wkd.rs') diff --git a/net/src/wkd.rs b/net/src/wkd.rs index 7a81831e..d2b6b4b9 100644 --- a/net/src/wkd.rs +++ b/net/src/wkd.rs @@ -211,8 +211,7 @@ where if let Ok(ref resp) = response { if resp.status().is_redirection() { let url = resp.headers().get("Location") - .map(|value| value.to_str().ok()) - .flatten() + .and_then(|value| value.to_str().ok()) .map(|value| value.parse::()); if let Some(Ok(url)) = url { return get_following_redirects(client, url, depth - 1).await; -- cgit v1.2.3