Skip to content

Commit

Permalink
transpile: fix #[warn(for_loops_over_fallibles)]
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen committed Aug 28, 2024
1 parent 1046fca commit 0c5bd33
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions c2rust-transpile/src/c_ast/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ fn immediate_stmt_children(kind: &CStmtKind) -> Vec<SomeId> {
false_variant: opt_s,
} => {
let mut res = intos![e, s];
for &x in &opt_s {
res.push(x.into())
if let Some(x) = opt_s {
res.push(x.into());
}
res
}
Expand All @@ -239,14 +239,14 @@ fn immediate_stmt_children(kind: &CStmtKind) -> Vec<SomeId> {
body: d,
} => {
let mut res = vec![];
for &x in &a {
res.push(x.into())
if let Some(x) = a {
res.push(x.into());
}
for &x in &b {
res.push(x.into())
if let Some(x) = b {
res.push(x.into());
}
for &x in &c {
res.push(x.into())
if let Some(x) = c {
res.push(x.into());
}
res.push(d.into());
res
Expand Down

0 comments on commit 0c5bd33

Please sign in to comment.