Kixunil / configure_me

A Rust library for processing application configuration easily
62 stars 14 forks source link

cargo clippy error and warnings #57

Closed ismaelsadeeq closed 1 year ago

ismaelsadeeq commented 1 year ago

Refer to https://github.com/carlaKC/lndk/pull/23 cargo run works perfectly fine. cargo clippy has two warnings and one error. The configure me configurations are exactly as specified in https://crates.io/crates/configure_me.


warning: useless conversion to the same type: `std::string::String`
   --> /home/abubakarsadiq/Desktop/lnd/lndk/target/debug/build/lndk-adc3c2df15fa64b9/out/configure_me_config.rs:166:26
    |
166 |                 address: address.into(),
    |                          ^^^^^^^^^^^^^^ help: consider removing `.into()`: `address`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

warning: useless conversion to the same type: `std::string::String`
   --> /home/abubakarsadiq/Desktop/lnd/lndk/target/debug/build/lndk-adc3c2df15fa64b9/out/configure_me_config.rs:167:23
    |
167 |                 cert: cert.into(),
    |                       ^^^^^^^^^^^ help: consider removing `.into()`: `cert`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: useless conversion to the same type: `std::string::String`
   --> /home/abubakarsadiq/Desktop/lnd/lndk/target/debug/build/lndk-adc3c2df15fa64b9/out/configure_me_config.rs:168:27
    |
168 |                 macaroon: macaroon.into(),
    |                           ^^^^^^^^^^^^^^^ help: consider removing `.into()`: `macaroon`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

error: this loop never actually loops
   --> /home/abubakarsadiq/Desktop/lnd/lndk/target/debug/build/lndk-adc3c2df15fa64b9/out/configure_me_config.rs:207:21
    |
207 | /                     for short in &mut shorts {
208 | |                         if short == 'h' {
209 | |                             return Err(ArgParseError::HelpRequested(self._program_path.as_ref().unwrap().to_string_lossy().into()).into())
210 | |                         } else {
...   |
215 | |                         }
216 | |                     }
    | |_____________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
    = note: `#[deny(clippy::never_loop)]` on by default
help: if you need the first element of the iterator, try writing
    |
207 |                     if let Some(short) = (&mut shorts).next() {
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: `lndk` (bin "lndk") generated 3 warnings
error: could not compile `lndk` due to previous error; 3 warnings emitted

Steps to recreate run cargo clippy on a new configured project.

Kixunil commented 1 year ago

This was already addressed by 7122f8e3350fcfdc30abb382f74462b93e76b7dd. The new version was not released yet since I plan more (breaking) changes. In the meantime it's possible to allow the lints.