Rollup merge of #112655 - WaffleLapkin:must_use_map_or, r=workingjubilee

Mark `map_or` as `#[must_use]`

I don't know what else to say.

r? libs
This commit is contained in:
Matthias Krüger 2023-07-30 14:25:08 +02:00 committed by GitHub
commit e3bf088fb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 10 deletions

View file

@ -443,9 +443,9 @@ impl<'a, 'tcx> Visitor<'tcx> for DropRangeVisitor<'a, 'tcx> {
// We add an edge to the hir_id of the expression/block we are breaking out of, and
// then in process_deferred_edges we will map this hir_id to its PostOrderId, which
// will refer to the end of the block due to the post order traversal.
self.find_target_expression_from_destination(destination).map_or((), |target| {
if let Ok(target) = self.find_target_expression_from_destination(destination) {
self.drop_ranges.add_control_edge_hir_id(self.expr_index, target)
});
}
if let Some(value) = value {
self.visit_expr(value);

View file

@ -150,9 +150,10 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
hir.node_to_string(diag_expr_id),
hir.node_to_string(parent)
);
place_with_id
.try_into()
.map_or((), |tracked_value| self.mark_consumed(parent, tracked_value));
if let Ok(tracked_value) = place_with_id.try_into() {
self.mark_consumed(parent, tracked_value)
}
}
fn borrow(