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 25, 2024
1 parent c7d0f2f commit 6c3e7af
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 6c3e7af

Please sign in to comment.