Skip to content

Commit

Permalink
Use Option::then in two places
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Feb 2, 2022
1 parent d5f9c40 commit 08be313
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/matches/mod.rs
Expand Up @@ -264,7 +264,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// 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;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_system/src/dep_graph/serialized.rs
Expand Up @@ -182,7 +182,7 @@ impl<K: DepKind> EncoderState<K> {
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),
}
}

Expand Down

0 comments on commit 08be313

Please sign in to comment.