Closed kpp closed 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.
Alright. Which lints do you want to keep and which lints do you want to disable?
I would wait for @cogciprocate to weigh in.
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.
It should be possible to specify a crate-level attribute to disable lints - #![allow(...)]
at the top of the crate entry point (lib.rs
).
Ok, I will fix it. Do you mean to remove all clippy lints from ocl-sys?
Yeah or just modify the PR to exclude changes to the files in that directory (cl-sys
).
At least the command "cargo clippy --verbose" exited with 0.
Looks great. Thanks!
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("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