Skip to content

Commit dfc52ab

Browse files
committed
transpile: refactor out method in fn convert_pointer_is_null
1 parent 9106297 commit dfc52ab

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

c2rust-transpile/src/translator/pointers.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,8 @@ impl<'c> Translation<'c> {
573573
negated: bool,
574574
) -> TranslationResult<Box<Expr>> {
575575
Ok(if self.ast_context.is_function_pointer(ptr_type) {
576-
if negated {
577-
mk().method_call_expr(e, "is_some", vec![])
578-
} else {
579-
mk().method_call_expr(e, "is_none", vec![])
580-
}
576+
let method = if negated { "is_some" } else { "is_none" };
577+
mk().method_call_expr(e, method, vec![])
581578
} else {
582579
// TODO: `pointer::is_null` becomes stably const in Rust 1.84.
583580
if ctx.is_const {

0 commit comments

Comments
 (0)