Rollup merge of #93589 - est31:option_then, r=cjgillot

Use Option::then in two places
This commit is contained in:
Yuki Okushi 2022-02-03 22:20:27 +09:00 committed by GitHub
commit 7712dfd46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -264,7 +264,7 @@ fn lower_match_tree<'pat>(
// The set of places that we are creating fake borrows of. If there are
// no match guards then we don't need any fake borrows, so don't track
// them.
let mut fake_borrows = if match_has_guard { Some(FxHashSet::default()) } else { None };
let mut fake_borrows = match_has_guard.then(FxHashSet::default);
let mut otherwise = None;

View File

@ -182,7 +182,7 @@ fn new(encoder: FileEncoder, record_stats: bool) -> Self {
total_edge_count: 0,
total_node_count: 0,
result: Ok(()),
stats: if record_stats { Some(FxHashMap::default()) } else { None },
stats: record_stats.then(FxHashMap::default),
}
}