Skip to content

Commit

Permalink
Revert "Refactor is_va_decl to use .map() and `.unwrap_or_default…
Browse files Browse the repository at this point in the history
…()`."

Avoid code churn that doesn't have clear benefits.

This reverts commit 3866a89.
  • Loading branch information
kkysen committed Aug 26, 2022
1 parent 8ac1538 commit 2439ed4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions c2rust-transpile/src/translator/variadic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ macro_rules! match_or {
impl<'c> Translation<'c> {
/// Returns `true` iff `va_start`, `va_end`, or `va_copy` may be called on `decl_id`.
pub fn is_va_decl(&self, decl_id: CDeclId) -> bool {
self.function_context
.borrow()
.va_list_decl_ids
.as_ref()
.map(|decls| decls.contains(&decl_id))
.unwrap_or(false)
let fn_ctx = self.function_context.borrow();
if let Some(ref decls) = fn_ctx.va_list_decl_ids {
decls.contains(&decl_id)
} else {
false
}
}

pub fn match_vastart(&self, expr: CExprId) -> Option<CDeclId> {
Expand Down

0 comments on commit 2439ed4

Please sign in to comment.