From b192841cfad22ae6274d019d4c0fd8fe1a5e4437 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Tue, 13 Sep 2022 00:43:11 +0200 Subject: [PATCH] fix causes of some clippy warnings Clippy linting had some errors: error: boolean to int conversion using if Error: --> src/builders/module.rs:59:29 | 59 | zend_debug: if PHP_DEBUG { 1 } else { 0 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(PHP_DEBUG)` | = note: `-D clippy::bool-to-int-with-if` implied by `-D warnings` = note: `PHP_DEBUG as u8` or `PHP_DEBUG.into()` can also be valid options = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if error: boolean to int conversion using if Error: --> src/builders/module.rs:60:22 | 60 | zts: if PHP_ZTS { 1 } else { 0 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(PHP_ZTS)` | = note: `PHP_ZTS as u8` or `PHP_ZTS.into()` can also be valid options = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if error: could not compile `ext-php-rs` due to 2 previous errors This commit tries to fix those. --- src/builders/module.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builders/module.rs b/src/builders/module.rs index a8aeccd635..6eaaf51c0c 100644 --- a/src/builders/module.rs +++ b/src/builders/module.rs @@ -56,8 +56,8 @@ impl ModuleBuilder { module: ModuleEntry { size: mem::size_of::() as u16, zend_api: ZEND_MODULE_API_NO, - zend_debug: if PHP_DEBUG { 1 } else { 0 }, - zts: if PHP_ZTS { 1 } else { 0 }, + zend_debug: u8::from(PHP_DEBUG), + zts: u8::from(PHP_ZTS), ini_entry: ptr::null(), deps: ptr::null(), name: ptr::null(),