Closed brenomfviana closed 4 years ago
I fixed some Clippy warnings in my pull request. But there are still the following warnings and errors:
warning: called `skip(x).next()` on an iterator --> curl-sys/build.rs:527:24 | 527 | let path = line.split('=').skip(1).next()?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::iter_skip_next)]` on by default = help: this is more succinctly expressed by calling `nth(x)` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next warning: 1 warning emitted Checking curl v0.4.33 (curl-rust) warning: you should consider adding a `Default` implementation for `easy::form::Form` --> src/easy/form.rs:36:5 | 36 | / pub fn new() -> Form { 37 | | Form { 38 | | head: ptr::null_mut(), 39 | | tail: ptr::null_mut(), ... | 43 | | } 44 | | } | |_____^ | = 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 | 34 | impl Default for easy::form::Form { 35 | fn default() -> Self { 36 | Self::new() 37 | } 38 | } | warning: very complex type used. Consider factoring parts into `type` definitions --> src/easy/handle.rs:108:12 | 108 | write: Option<Box<dyn FnMut(&[u8]) -> Result<usize, WriteError> + 'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::type_complexity)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity warning: very complex type used. Consider factoring parts into `type` definitions --> src/easy/handle.rs:109:11 | 109 | read: Option<Box<dyn FnMut(&mut [u8]) -> Result<usize, ReadError> + 'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity warning: very complex type used. Consider factoring parts into `type` definitions --> src/easy/handle.rs:111:12 | 111 | debug: Option<Box<dyn FnMut(InfoType, &[u8]) + 'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity warning: very complex type used. Consider factoring parts into `type` definitions --> src/easy/handle.rs:113:15 | 113 | progress: Option<Box<dyn FnMut(f64, f64, f64, f64) -> bool + 'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity warning: very complex type used. Consider factoring parts into `type` definitions --> src/easy/handle.rs:114:14 | 114 | ssl_ctx: Option<Box<dyn FnMut(*mut c_void) -> Result<(), Error> + 'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity warning: you should consider adding a `Default` implementation for `easy::handle::Easy` --> src/easy/handle.rs:125:5 | 125 | / pub fn new() -> Easy { 126 | | Easy { 127 | | inner: Easy2::new(EasyData { 128 | | running: Cell::new(false), ... | 132 | | } 133 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 117 | impl Default for easy::handle::Easy { 118 | fn default() -> Self { 119 | Self::new() 120 | } 121 | } | error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. --> src/easy/handler.rs:114:9 | 114 | drop(data); | ^^^^^^^^^^ | = note: `#[deny(clippy::drop_ref)]` on by default note: argument has type `&mut [u8]` --> src/easy/handler.rs:114:14 | 114 | drop(data); | ^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drop_ref error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact. --> src/easy/handler.rs:138:9 | 138 | drop(whence); | ^^^^^^^^^^^^ | = note: `#[deny(clippy::drop_copy)]` on by default note: argument has type std::io::SeekFrom --> src/easy/handler.rs:138:14 | 138 | drop(whence); | ^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drop_copy error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing. --> src/easy/handler.rs:188:9 | 188 | drop(data); | ^^^^^^^^^^ | note: argument has type `&[u8]` --> src/easy/handler.rs:188:14 | 188 | drop(data); | ^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drop_ref error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact. --> src/easy/handler.rs:224:9 | 224 | drop((dltotal, dlnow, ultotal, ulnow)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: argument has type (f64, f64, f64, f64) --> src/easy/handler.rs:224:14 | 224 | drop((dltotal, dlnow, ultotal, ulnow)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#drop_copy warning: `0 as *const _` detected --> src/easy/handler.rs:1274:55 | 1274 | self.setopt_ptr(curl_sys::CURLOPT_POSTFIELDS, 0 as *const _)?; | ^^^^^^^^^^^^^ help: try: `std::ptr::null()` | = 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: Calling `subsec_millis()` is more concise than this calculation --> src/easy/handler.rs:1669:45 | 1669 | let ms = timeout.as_secs() * 1000 + (timeout.subsec_nanos() / 1_000_000) as u64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `timeout.subsec_millis()` | = note: `#[warn(clippy::duration_subsec)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec warning: Calling `subsec_millis()` is more concise than this calculation --> src/easy/handler.rs:1780:45 | 1780 | let ms = timeout.as_secs() * 1000 + (timeout.subsec_nanos() / 1_000_000) as u64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `timeout.subsec_millis()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec warning: this if-then-else expression returns a bool literal --> src/easy/handler.rs:2280:17 | 2280 | / if r == 0 { 2281 | | false 2282 | | } else { 2283 | | true 2284 | | } | |_________________^ help: you can reduce it to: `!(r == 0)` | = note: `#[warn(clippy::needless_bool)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool warning: length comparison to zero --> src/easy/handler.rs:2735:12 | 2735 | if s.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.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: length comparison to zero --> src/easy/handler.rs:2754:12 | 2754 | if s.len() == 0 { | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero warning: `0 as *const _` detected --> src/easy/handler.rs:2909:25 | 2909 | let mut p = 0 as *const c_char; | ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::null::<c_char>()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr warning: use of `unwrap_or` followed by a function call --> src/easy/handler.rs:2964:52 | 2964 | let pos = buf.iter().position(|i| *i == 0).unwrap_or(buf.len()); | ^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| buf.len())` | = 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 warning: you should consider adding a `Default` implementation for `easy::handler::Auth` --> src/easy/handler.rs:3175:5 | 3175 | / pub fn new() -> Auth { 3176 | | Auth { bits: 0 } 3177 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 3170 | impl Default for easy::handler::Auth { 3171 | fn default() -> Self { 3172 | Self::new() 3173 | } 3174 | } | warning: you should consider adding a `Default` implementation for `easy::handler::SslOpt` --> src/easy/handler.rs:3283:5 | 3283 | / pub fn new() -> SslOpt { 3284 | | SslOpt { bits: 0 } 3285 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 3281 | impl Default for easy::handler::SslOpt { 3282 | fn default() -> Self { 3283 | Self::new() 3284 | } 3285 | } | warning: you should consider adding a `Default` implementation for `easy::list::List` --> src/easy/list.rs:32:5 | 32 | / pub fn new() -> List { 33 | | List { 34 | | raw: ptr::null_mut(), 35 | | } 36 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 30 | impl Default for easy::list::List { 31 | fn default() -> Self { 32 | Self::new() 33 | } 34 | } | warning: you should consider adding a `Default` implementation for `multi::Multi` --> src/multi.rs:98:5 | 98 | / pub fn new() -> Multi { 99 | | unsafe { 100 | | ::init(); 101 | | let ptr = curl_sys::curl_multi_init(); ... | 110 | | } 111 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 95 | impl Default for multi::Multi { 96 | fn default() -> Self { 97 | Self::new() 98 | } 99 | } | warning: you should consider adding a `Default` implementation for `multi::Events` --> src/multi.rs:1010:5 | 1010 | / pub fn new() -> Events { 1011 | | Events { bits: 0 } 1012 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 1008 | impl Default for multi::Events { 1009 | fn default() -> Self { 1010 | Self::new() 1011 | } 1012 | } | warning: you should consider adding a `Default` implementation for `multi::WaitFd` --> src/multi.rs:1085:5 | 1085 | / pub fn new() -> WaitFd { 1086 | | WaitFd { 1087 | | inner: curl_sys::curl_waitfd { 1088 | | fd: 0, ... | 1092 | | } 1093 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try this | 1083 | impl Default for multi::WaitFd { 1084 | fn default() -> Self { 1085 | Self::new() 1086 | } 1087 | } | error: aborting due to 4 previous errors; 21 warnings emitted
Thanks for the report! I would prefer to not keep an issue tracking this, however, since clippy is not something I'm tracking on this repository.
I fixed some Clippy warnings in my pull request. But there are still the following warnings and errors: