We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
method
fn convert_pointer_is_null
1 parent 9106297 commit dfc52abCopy full SHA for dfc52ab
1 file changed
c2rust-transpile/src/translator/pointers.rs
@@ -573,11 +573,8 @@ impl<'c> Translation<'c> {
573
negated: bool,
574
) -> TranslationResult<Box<Expr>> {
575
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
- }
+ let method = if negated { "is_some" } else { "is_none" };
+ mk().method_call_expr(e, method, vec![])
581
} else {
582
// TODO: `pointer::is_null` becomes stably const in Rust 1.84.
583
if ctx.is_const {
0 commit comments