cogciprocate / ocl

OpenCL for Rust
Other
731 stars 75 forks source link

Fix obvious clippy warnings #144

Closed kpp closed 5 years ago

kpp commented 5 years ago

Fixed these warnings:

Lots of warnings ``` warning: long literal lacking separators --> cl-sys/src/cl_gl_ext_h.rs:6:81 | 6 | pub const CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE: cl_context_properties = 0x10000000; | ^^^^^^^^^^ help: consider: `0x1000_0000` | = note: #[warn(clippy::unreadable_literal)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal warning: long literal lacking separators --> cl-sys/src/cl_h.rs:212:70 | 212 | pub const CL_DEVICE_TYPE_ALL: cl_bitfield = 0xFFFFFFFF; | ^^^^^^^^^^ help: consider: `0xFFFF_FFFF` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:207:70 | 207 | pub const CL_DEVICE_TYPE_DEFAULT: cl_bitfield = 1 << 0; | ^^^^^^ | = note: #[warn(clippy::identity_op)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:315:71 | 315 | pub const CL_FP_DENORM: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:334:71 | 334 | pub const CL_EXEC_KERNEL: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:338:71 | 338 | pub const CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:361:71 | 361 | pub const CL_DEVICE_AFFINITY_DOMAIN_NUMA: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:370:74 | 370 | pub const CL_DEVICE_SVM_COARSE_GRAIN_BUFFER: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:385:71 | 385 | pub const CL_MEM_READ_WRITE: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:401:71 | 401 | pub const CL_MIGRATE_MEM_OBJECT_HOST: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:512:71 | 512 | pub const CL_MAP_READ: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> cl-sys/src/cl_h.rs:581:71 | 581 | pub const CL_KERNEL_ARG_TYPE_CONST: cl_bitfield = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op Checking jpeg-decoder v0.1.15 Checking image v0.21.1 warning: redundant field names in struct initialization --> ocl-core/src/functions.rs:153:13 | 153 | status: status, | ^^^^^^^^^^^^^^ help: replace it with: `status` | = note: #[warn(clippy::redundant_field_names)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/functions.rs:154:13 | 154 | fn_name: fn_name, | ^^^^^^^^^^^^^^^^ help: replace it with: `fn_name` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/functions.rs:155:13 | 155 | fn_info: fn_info, | ^^^^^^^^^^^^^^^^ help: replace it with: `fn_info` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/types/structs.rs:227:25 | 227 | OpenclVersion { ver: ver } | ^^^^^^^^ help: replace it with: `ver` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/types/structs.rs:712:13 | 712 | origin: origin, | ^^^^^^^^^^^^^^ help: replace it with: `origin` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/types/structs.rs:713:13 | 713 | len: len, | ^^^^^^^^ help: replace it with: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/types/structs.rs:985:13 | 985 | image_type: image_type, | ^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `image_type` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/types/structs.rs:994:13 | 994 | buffer: buffer, | ^^^^^^^^^^^^^^ help: replace it with: `buffer` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> ocl-core/src/error.rs:115:17 | 115 | Error { inner: inner } | ^^^^^^^^^^^^ help: replace it with: `inner` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: Constants have by default a `'static` lifetime --> ocl-core/src/functions.rs:65:27 | 65 | const CL_GL_SHARING_EXT: &'static str = "cl_khr_gl_sharing"; | -^^^^^^^---- help: consider removing `'static`: `&str` | = note: #[warn(clippy::const_static_lifetime)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime warning: this if statement can be collapsed --> ocl-core/src/functions.rs:2430:5 | 2430 | / if errcode < 0 { 2431 | | if Status::from_i32(errcode).unwrap() == Status::CL_INVALID_VALUE { 2432 | | return Err(OclCoreError::from("")); 2433 | | } 2434 | | } | |_____^ | = note: #[warn(clippy::collapsible_if)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if help: try | 2430 | if errcode < 0 && Status::from_i32(errcode).unwrap() == Status::CL_INVALID_VALUE { 2431 | return Err(OclCoreError::from("")); 2432 | } | warning: long literal lacking separators --> ocl-core/src/lib.rs:356:21 | 356 | const ALL = 0xFFFFFFFF; | ^^^^^^^^^^ help: consider: `0xFFFF_FFFF` | = note: #[warn(clippy::unreadable_literal)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal warning: length comparison to zero --> ocl-core/src/functions.rs:235:8 | 235 | if device_ids.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `device_ids.is_empty()` | = note: #[warn(clippy::len_zero)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: `0 as *const _` detected. Consider using `ptr::null()` --> ocl-core/src/functions.rs:409:17 | 409 | None => 0 as *const size_t, | ^^^^^^^^^^^^^^^^^^ | = note: #[warn(clippy::zero_ptr)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: using `clone` on a `Copy` type --> ocl-core/src/functions.rs:439:25 | 439 | let vers = [pv.clone()]; | ^^^^^^^^^^ help: try dereferencing it: `*pv` | = note: #[warn(clippy::clone_on_copy)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/functions.rs:453:24 | 453 | let ver = [pv.clone()]; | ^^^^^^^^^^ help: try dereferencing it: `*pv` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:636:9 | 636 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:667:9 | 667 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: length comparison to zero --> ocl-core/src/functions.rs:744:8 | 744 | if device_ids.len() == 0 { | ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `device_ids.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:886:9 | 886 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:919:9 | 919 | 0 as *mut usize, | ^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1018:9 | 1018 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1044:9 | 1044 | 0 as *mut usize, | ^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1107:9 | 1107 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1125:9 | 1125 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: length comparison to zero --> ocl-core/src/functions.rs:1493:72 | 1493 | debug_assert!(image_formats.len() == num_image_formats as usize && image_formats.len() > 0); | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `!image_formats.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1501:9 | 1501 | 0 as *mut cl_uint, | ^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1517:9 | 1517 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1535:9 | 1535 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1550:9 | 1550 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1568:9 | 1568 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1629:9 | 1629 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1651:9 | 1651 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: length comparison to zero --> ocl-core/src/functions.rs:1707:8 | 1707 | if devices.len() == 0 { | ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `devices.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: length comparison to zero --> ocl-core/src/functions.rs:1875:37 | 1875 | let (input_ptr, names_ptr) = if input_headers.len()==0 { | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `input_headers.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1977:9 | 1977 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:1995:9 | 1995 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2020:9 | 2020 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: redundant closure found --> ocl-core/src/functions.rs:2030:52 | 2030 | get_program_info_binaries(program).map(|b| ProgramInfoResult::Binaries(b)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `ProgramInfoResult::Binaries` | = note: #[warn(clippy::redundant_closure)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2050:9 | 2050 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2069:9 | 2069 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2155:9 | 2155 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2173:9 | 2173 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2202:9 | 2202 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2225:9 | 2225 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2243:9 | 2243 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: using `clone` on a `Copy` type --> ocl-core/src/functions.rs:2258:66 | 2258 | return Ok(KernelWorkGroupInfoResult::Unavailable(status.clone())); | ^^^^^^^^^^^^^^ help: try removing the `clone` call: `status` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: identical conversion --> ocl-core/src/functions.rs:2262:20 | 2262 | return Err(OclCoreError::from(err)); | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = note: #[warn(clippy::identity_conversion)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2278:9 | 2278 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2308:9 | 2308 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2326:9 | 2326 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2421:9 | 2421 | 0 as *mut c_void, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:2450:9 | 2450 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:3607:18 | 3607 | if ext_fn == 0 as *mut c_void { | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/functions.rs:3811:9 | 3811 | 0 as *mut size_t, | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: identical conversion --> ocl-core/src/types/abs.rs:144:29 | 144 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: identical conversion --> ocl-core/src/types/abs.rs:159:29 | 159 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/types/abs.rs:351:20 | 351 | PlatformId(0 as *mut c_void) | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: `0 as *mut _` detected. Consider using `ptr::null_mut()` --> ocl-core/src/types/abs.rs:413:18 | 413 | DeviceId(0 as *mut c_void) | ^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: identical conversion --> ocl-core/src/types/abs.rs:501:29 | 501 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: identical conversion --> ocl-core/src/types/abs.rs:611:29 | 611 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: identical conversion --> ocl-core/src/types/abs.rs:823:29 | 823 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: identical conversion --> ocl-core/src/types/abs.rs:907:29 | 907 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: identical conversion --> ocl-core/src/types/abs.rs:1065:29 | 1065 | Err(err) => Err(OclCoreError::from(err)), | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OclCoreError::from()`: `err` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: `0 as *const _` detected. Consider using `ptr::null()` --> ocl-core/src/types/abs.rs:1140:31 | 1140 | if self.0.is_null() { 0 as *const cl_event } else { &self.0 as *const cl_event } | ^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:468:26 | 468 | Some(plat.clone()) | ^^^^^^^^^^^^ help: try dereferencing it: `*plat` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:500:36 | 500 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:504:36 | 504 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:508:36 | 508 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:512:36 | 512 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:516:36 | 516 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:520:36 | 520 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> ocl-core/src/types/structs.rs:524:36 | 524 | props_raw.push(key.clone() as isize); | ^^^^^^^^^^^ help: try dereferencing it: `*key` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: use of `ok_or` followed by a function call --> ocl-core/src/types/structs.rs:591:60 | 591 | let key = ContextProperty::from_isize(key_raw).ok_or(OclCoreError::from( | ____________________________________________________________^ 592 | | format!("ContextProperties::from_raw: Unable to convert '{}' using \ 593 | | 'ContextProperty::from_isize'.", key_raw)))?; | |_______________________________________________________________^ | = note: #[warn(clippy::or_fun_call)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call help: try this | 591 | let key = ContextProperty::from_isize(key_raw).ok_or_else(|| OclCoreError::from( 592 | format!("ContextProperties::from_raw: Unable to convert '{}' using \ 593 | 'ContextProperty::from_isize'.", key_raw)))?; | warning: redundant closure found --> ocl-core/src/types/structs.rs:839:34 | 839 | list_raw.into_iter().map(|fmt_raw| ImageFormat::from_raw(fmt_raw)).collect() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `ImageFormat::from_raw` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure warning: casting u8 to u32 may become silently lossy if types change --> ocl-core/src/util.rs:99:5 | 99 | bytes[0] as u32 | | ^^^^^^^^^^^^^^^ help: try: `u32::from(bytes[0])` | = note: #[warn(clippy::cast_lossless)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless warning: casting u8 to u32 may become silently lossy if types change --> ocl-core/src/util.rs:100:6 | 100 | ((bytes[1] as u32) << 8) | | ^^^^^^^^^^^^^^^^^ help: try: `u32::from(bytes[1])` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless warning: casting u8 to u32 may become silently lossy if types change --> ocl-core/src/util.rs:101:6 | 101 | ((bytes[2] as u32) << 16) | | ^^^^^^^^^^^^^^^^^ help: try: `u32::from(bytes[2])` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless warning: casting u8 to u32 may become silently lossy if types change --> ocl-core/src/util.rs:102:6 | 102 | ((bytes[3] as u32) << 24) | ^^^^^^^^^^^^^^^^^ help: try: `u32::from(bytes[3])` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:351:25 | 351 | const DEFAULT = 1 << 0; | ^^^^^^ | = note: #[warn(clippy::identity_op)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:385:24 | 385 | const DENORM = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:409:24 | 409 | const KERNEL = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:421:47 | 421 | const OUT_OF_ORDER_EXEC_MODE_ENABLE = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:452:22 | 452 | const NUMA = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:472:28 | 472 | const READ_WRITE = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:517:29 | 517 | const OBJECT_HOST = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:529:22 | 529 | const READ = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `1` --> ocl-core/src/lib.rs:572:23 | 572 | const CONST = 1 << 0; | ^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op error: aborting due to 2 previous errors error: Could not compile `ocl-core`. ```

Stll there are many of them:

Warnings left so far ``` warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 775 | cl_vec!(Char8, 8, i8, i); | ------------------------- in this macro invocation | = note: #[warn(clippy::too_many_arguments)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 783 | cl_vec!(Char16, 16, i8, i); | --------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 820 | cl_vec!(Uchar8, 8, u8, u); | -------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 827 | cl_vec!(Uchar16, 16, u8, u); | ---------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 864 | cl_vec!(Short8, 8, i16, i); | --------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 872 | cl_vec!(Short16, 16, i16, i); | ----------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 911 | cl_vec!(Ushort8, 8, u16, u); | ---------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 919 | cl_vec!(Ushort16, 16, u16, u); | ------------------------------ in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 971 | cl_vec!(Int8, 8, i32, i); | ------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 979 | cl_vec!(Int16, 16, i32, i); | --------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1017 | cl_vec!(Uint8, 8, i8, u); | ------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1025 | cl_vec!(Uint16, 16, u32, u); | ---------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1068 | cl_vec!(Long8, 8, i64, i); | -------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1076 | cl_vec!(Long16, 16, i64, i); | ---------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1119 | cl_vec!(Ulong8, 8, u64, u); | --------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1127 | cl_vec!(Ulong16, 16, u64, u); | ----------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1220 | cl_vec!(Float8, 8, f32, f); | --------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1228 | cl_vec!(Float16, 16, f32, f); | ----------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1266 | cl_vec!(Double8, 8, f64, f); | ---------------------------- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (16/7) --> ocl-core/ocl-core-vector/src/vectors.rs:663:13 | 663 | / pub fn new($( $field: $ty, )+) -> $name { 664 | | $name([$( $field, )*]) 665 | | } | |_____________^ ... 1274 | cl_vec!(Double16, 16, f64, f); | ------------------------------ in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments Checking failure v0.1.5 Checking tiff v0.2.2 Checking image v0.21.1 warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/functions.rs:710:37 | 710 | pub unsafe fn retain_device(device: &DeviceId, device_version: Option<&OpenclVersion>) | ^^^^^^^^^ help: consider passing by value instead: `DeviceId` | = note: #[warn(clippy::trivially_copy_pass_by_ref)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/functions.rs:719:38 | 719 | pub unsafe fn release_device(device: &DeviceId, device_version: Option<&OpenclVersion>) | ^^^^^^^^^ help: consider passing by value instead: `DeviceId` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:1850:1 | 1850 | / pub fn compile_program( 1851 | | program: &Program, 1852 | | devices: Option<&[D]>, 1853 | | options: &CString, ... | 1907 | | } 1908 | | } | |_^ | = note: #[warn(clippy::too_many_arguments)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (13/7) --> ocl-core/src/functions.rs:2540:1 | 2540 | / pub unsafe fn enqueue_read_buffer_rect( 2541 | | command_queue: &CommandQueue, 2542 | | buffer: M, 2543 | | block: bool, ... | 2592 | | eval_errcode(errcode, (), "clEnqueueReadBufferRect", None::) 2593 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (13/7) --> ocl-core/src/functions.rs:2648:1 | 2648 | / pub unsafe fn enqueue_write_buffer_rect( 2649 | | command_queue: &CommandQueue, 2650 | | buffer: M, 2651 | | block: bool, ... | 2690 | | eval_errcode(errcode, (), "clEnqueueWriteBufferRect", None::) 2691 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:2699:1 | 2699 | / pub fn enqueue_fill_buffer( 2700 | | command_queue: &CommandQueue, 2701 | | buffer: M, 2702 | | pattern: T, ... | 2732 | | eval_errcode(errcode, (), "clEnqueueFillBuffer", None::) 2733 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:2736:1 | 2736 | / pub fn enqueue_copy_buffer( 2737 | | command_queue: &CommandQueue, 2738 | | src_buffer: M, 2739 | | dst_buffer: M, ... | 2766 | | eval_errcode(errcode, (), "clEnqueueCopyBuffer", None::) 2767 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (12/7) --> ocl-core/src/functions.rs:2774:1 | 2774 | / pub fn enqueue_copy_buffer_rect( 2775 | | command_queue: &CommandQueue, 2776 | | src_buffer: M, 2777 | | dst_buffer: M, ... | 2814 | | eval_errcode(errcode, (), "clEnqueueCopyBufferRect", None::) 2815 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (10/7) --> ocl-core/src/functions.rs:2887:1 | 2887 | / pub unsafe fn enqueue_read_image( 2888 | | command_queue: &CommandQueue, 2889 | | image: M, 2890 | | block: bool, ... | 2917 | | eval_errcode(errcode, (), "clEnqueueReadImage", None::) 2918 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (10/7) --> ocl-core/src/functions.rs:2933:1 | 2933 | / pub unsafe fn enqueue_write_image( 2934 | | command_queue: &CommandQueue, 2935 | | image: M, 2936 | | block: bool, ... | 2963 | | eval_errcode(errcode, (), "clEnqueueWriteImage", None::) 2964 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:2984:1 | 2984 | / pub fn enqueue_fill_image( 2985 | | command_queue: &CommandQueue, 2986 | | image: M, 2987 | | color: &[T], ... | 3013 | | eval_errcode(errcode, (), "clEnqueueFillImage", None::) 3014 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:3020:1 | 3020 | / pub fn enqueue_copy_image( 3021 | | command_queue: &CommandQueue, 3022 | | src_image: &Mem, 3023 | | dst_image: &Mem, ... | 3046 | | eval_errcode(errcode, (), "clEnqueueCopyImage", None::) 3047 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:3055:1 | 3055 | / pub fn enqueue_copy_image_to_buffer( 3056 | | command_queue: &CommandQueue, 3057 | | src_image: M, 3058 | | dst_buffer: M, ... | 3083 | | eval_errcode(errcode, (), "clEnqueueCopyImageToBuffer", None::) 3084 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:3092:1 | 3092 | / pub fn enqueue_copy_buffer_to_image( 3093 | | command_queue: &CommandQueue, 3094 | | src_buffer: M, 3095 | | dst_image: M, ... | 3120 | | eval_errcode(errcode, (), "clEnqueueCopyBufferToImage", None::) 3121 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (9/7) --> ocl-core/src/functions.rs:3124:1 | 3124 | / unsafe fn _enqueue_map_buffer( 3125 | | command_queue: &CommandQueue, 3126 | | buffer: M, 3127 | | block: bool, ... | 3155 | | eval_errcode(errcode, mapped_ptr as *mut T, "clEnqueueMapBuffer", None::) 3156 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:3174:1 | 3174 | / pub unsafe fn enqueue_map_buffer( 3175 | | command_queue: &CommandQueue, 3176 | | buffer: M, 3177 | | block: bool, ... | 3192 | | mapped_ptr_res.map(|ptr| MemMap::from_raw(ptr)) 3193 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (10/7) --> ocl-core/src/functions.rs:3214:1 | 3214 | / pub unsafe fn enqueue_map_image( 3215 | | command_queue: &CommandQueue, 3216 | | image: M, 3217 | | block: bool, ... | 3259 | | .map(|ptr| MemMap::from_raw(ptr as *mut _ as *mut T)) 3260 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this function has too many arguments (8/7) --> ocl-core/src/functions.rs:3340:1 | 3340 | / pub unsafe fn enqueue_kernel ( 3341 | | command_queue: &CommandQueue, 3342 | | kernel: &Kernel, 3343 | | work_dims: u32, ... | 3422 | | } 3423 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/functions.rs:3589:23 | 3589 | platform: &PlatformId, | ^^^^^^^^^^^ help: consider passing by value instead: `PlatformId` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref error: you are deriving `Hash` but have implemented `PartialEq` explicitly --> ocl-core/src/types/abs.rs:338:30 | 338 | #[derive(Clone, Copy, Debug, Hash, Eq)] | ^^^^ | = note: #[deny(clippy::derive_hash_xor_eq)] on by default note: `PartialEq` implemented here --> ocl-core/src/types/abs.rs:378:1 | 378 | / impl PartialEq for PlatformId { 379 | | fn eq(&self, other: &PlatformId) -> bool { 380 | | self.0 == other.0 381 | | } 382 | | } | |_^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/abs.rs:355:19 | 355 | pub fn as_ptr(&self) -> cl_platform_id { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/abs.rs:360:20 | 360 | pub fn version(&self) -> OclCoreResult { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref error: you are deriving `Hash` but have implemented `PartialEq` explicitly --> ocl-core/src/types/abs.rs:400:30 | 400 | #[derive(Clone, Copy, Debug, Hash, Eq)] | ^^^^ | note: `PartialEq` implemented here --> ocl-core/src/types/abs.rs:446:1 | 446 | / impl PartialEq for DeviceId { 447 | | fn eq(&self, other: &DeviceId) -> bool { 448 | | self.0 == other.0 449 | | } 450 | | } | |_^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/abs.rs:417:19 | 417 | pub fn as_raw(&self) -> cl_device_id { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/abs.rs:422:20 | 422 | pub fn version(&self) -> OclCoreResult { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/structs.rs:111:29 | 111 | pub fn local(length: &usize) -> ArgVal<'a> | ^^^^^^ help: consider passing by value instead: `usize` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/structs.rs:168:16 | 168 | pub fn max(&self) -> OpenclVersion { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument is passed by reference, but would be more efficient if passed by value --> ocl-core/src/types/structs.rs:172:19 | 172 | pub fn to_raw(&self) -> (u16, u16) { | ^^^^^ help: consider passing by value instead: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: you should consider deriving a `Default` implementation for `types::structs::ContextProperties` --> ocl-core/src/types/structs.rs:324:5 | 324 | / pub fn new() -> ContextProperties { 325 | | ContextProperties { 326 | | props: HashMap::with_capacity(16), 327 | | contains_gl_context_or_sharegroup: false, 328 | | } 329 | | } | |_____^ | = note: #[warn(clippy::new_without_default)] on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 317 | #[derive(Default)] | warning: this function has too many arguments (8/7) --> ocl-core/src/types/structs.rs:981:5 | 981 | / pub fn new(image_type: MemObjectType, width: usize, height: usize, depth: usize, 982 | | array_size: usize, row_pitch: usize, slc_pitch: usize, buffer: Option, 983 | | ) -> ImageDescriptor { 984 | | ImageDescriptor { ... | 995 | | } 996 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments error: aborting due to 2 previous errors error: Could not compile `ocl-core`. warning: build failed, waiting for other jobs to finish... error: build failed ```
dmarcuse commented 5 years ago

I would argue that, given this comment, pretty much all of the lints for cl-sys should be ignored (or even disabled) in order to maintain consistency with the style of the OpenCL C API.

kpp commented 5 years ago

Alright. Which lints do you want to keep and which lints do you want to disable?

dmarcuse commented 5 years ago

I would wait for @cogciprocate to weigh in.

c0gent commented 5 years ago

Yeah I don't want to mess with cl-sys (for style reasons as @dmarcuse mentioned) The remaining ones on your 'fixed' list look legit. Is there a way to tell clippy to exclude that directory?

I'll go through and take a closer look at the others at some point, looks like at least few need addressing.

dmarcuse commented 5 years ago

It should be possible to specify a crate-level attribute to disable lints - #![allow(...)] at the top of the crate entry point (lib.rs).

kpp commented 5 years ago

Ok, I will fix it. Do you mean to remove all clippy lints from ocl-sys?

c0gent commented 5 years ago

Yeah or just modify the PR to exclude changes to the files in that directory (cl-sys).

kpp commented 5 years ago

At least the command "cargo clippy --verbose" exited with 0.

c0gent commented 5 years ago

Looks great. Thanks!