1
Fork 0

use if let Some(x) = .. instead of ...map(|x|) to conditionally run fns that return () (clippy::option_map_unit_fn)

This commit is contained in:
Matthias Krüger 2020-12-11 18:19:51 +01:00
parent b7795e135a
commit 5833f74a9c
2 changed files with 23 additions and 23 deletions

View file

@ -616,8 +616,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
debug!("stmt_expr Break val block_context.push(SubExpr)");
self.block_context.push(BlockFrame::SubExpr);
unpack!(block = self.into(destination, dest_scope, block, value));
dest_scope
.map(|scope| self.unschedule_drop(scope, destination.as_local().unwrap()));
if let Some(scope) = dest_scope {
self.unschedule_drop(scope, destination.as_local().unwrap())
};
self.block_context.pop();
} else {
self.cfg.push_assign_unit(block, source_info, destination, self.hir.tcx())