Skip to content

Commit

Permalink
analyze: rewrite::convert: clarify comment about nested OptionMapBegi…
Browse files Browse the repository at this point in the history
…n/End
  • Loading branch information
spernsteiner committed Jun 3, 2024
1 parent ceccafe commit ff20263
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion c2rust-analyze/src/rewrite/expr/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ impl<'tcx> ConvertVisitor<'tcx> {
) -> Option<(&[DistRewrite], &[DistRewrite])> {
for (i, mir_rw) in mir_rws.iter().enumerate() {
match mir_rw.rw {
// Bail out if we see nested delimiters.
// Bail out if we see nested delimiters. This prevents the special
// `Option::map` rewrite from applying, so the caller will fall back on the
// `unwrap()` + `Some(_)` rewrites for `OptionMapBegin/End` that are
// implemented in `convert_cast_rewrite`.
mir_op::RewriteKind::OptionMapBegin => return None,
mir_op::RewriteKind::OptionMapEnd => {
let (a, b) = mir_rws.split_at(i);
Expand Down

0 comments on commit ff20263

Please sign in to comment.