Skip to content

Commit

Permalink
fix: Use filter then map with bools instead of filter_map then
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Oct 5, 2023
1 parent d510e66 commit cb5c6b6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions object_store/src/azure/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,9 @@ fn string_to_sign(h: &HeaderMap, u: &Url, method: &Method, account: &str) -> Str
fn canonicalize_header(headers: &HeaderMap) -> String {
let mut names = headers
.iter()
.filter_map(|(k, _)| {
(k.as_str().starts_with("x-ms"))
// TODO remove unwraps
.then(|| (k.as_str(), headers.get(k).unwrap().to_str().unwrap()))
})
.filter(|&(k, _)| (k.as_str().starts_with("x-ms")))
// TODO remove unwraps
.map(|(k, _)| (k.as_str(), headers.get(k).unwrap().to_str().unwrap()))
.collect::<Vec<_>>();
names.sort_unstable();

Expand Down

0 comments on commit cb5c6b6

Please sign in to comment.