clippy hints

This commit is contained in:
Robin Appelman 2019-04-06 14:20:50 +02:00
commit 1ec6938bfa
4 changed files with 5 additions and 2 deletions

View file

@ -78,7 +78,7 @@ fn export_fn(item: ItemFn) -> TokenStream {
quote! { quote! {
#[no_mangle] #[no_mangle]
pub extern "C" fn #name(data: *const ::ivory::zend::ExecuteData, retval: *mut ::ivory::zend::ZVal) { pub unsafe extern "C" fn #name(data: *const ::ivory::zend::ExecuteData, retval: *mut ::ivory::zend::ZVal) {
let data: &::ivory::zend::ExecuteData = unsafe { data.as_ref() }.unwrap(); let data: &::ivory::zend::ExecuteData = unsafe { data.as_ref() }.unwrap();
// the less than case is handled during argument casting // the less than case is handled during argument casting
// this is needed for optional arguments // this is needed for optional arguments

View file

@ -14,6 +14,7 @@ macro_rules! impl_from_array_key {
($type:ty, $variant:ident, $type2:ty) => { ($type:ty, $variant:ident, $type2:ty) => {
impl From<$type> for ArrayKey { impl From<$type> for ArrayKey {
fn from(input: $type) -> Self { fn from(input: $type) -> Self {
#[allow(clippy::cast_lossless)]
ArrayKey::$variant(input as $type2) ArrayKey::$variant(input as $type2)
} }
} }

View file

@ -45,9 +45,10 @@ pub struct ModuleInternal {
impl ModuleInternal { impl ModuleInternal {
pub fn new(name: *const c_char, version: *const c_char) -> ModuleInternal { pub fn new(name: *const c_char, version: *const c_char) -> ModuleInternal {
#[allow(clippy::inconsistent_digit_grouping)]
ModuleInternal { ModuleInternal {
size: mem::size_of::<ModuleInternal>() as u16, size: mem::size_of::<ModuleInternal>() as u16,
zend_api: 20180731, zend_api: 2018_07_31,
zend_debug: 0, zend_debug: 0,
zts: 0, zts: 0,
ini_entry: std::ptr::null(), ini_entry: std::ptr::null(),

View file

@ -74,6 +74,7 @@ pub struct ZendStringHeader {
len: usize, len: usize,
} }
#[allow(clippy::cast_ptr_alignment)] // alignment of pointer casts is guaranteed by the layout
fn string_into_zend_str(string: String) -> *mut zend_string { fn string_into_zend_str(string: String) -> *mut zend_string {
let len = string.len(); let len = string.len();