Skip to content

Fix some (nightly) clippy warnings and unused imports

Marijn Suijten requested to merge MarijnS95/gstreamer-rs:cleanup into master

While working on this project I need nightly to run with --all-features (because of documentation, though that looks to have been solved mere hours ago :D. Also can't specify --features ... in the workspace...). That surfaces some preliminary warnings to fix, as well as some stray imports.

There is one remaining lint I'm not sure about, and am reluctant to introduce to other projects:

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:618:12
    |
618 |         if value < 0 || value > ffi::GST_FORMAT_PERCENT_MAX {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(0..=ffi::GST_FORMAT_PERCENT_MAX).contains(&value)`
    |
    = note: `#[warn(clippy::manual_range_contains)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:687:12
    |
687 |         if v < 0.0 || v > 1.0 {
    |            ^^^^^^^^^^^^^^^^^^ help: use: `!(0.0..=1.0).contains(&v)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:702:12
    |
702 |         if v < 0.0 || v > 1.0 {
    |            ^^^^^^^^^^^^^^^^^^ help: use: `!(0.0..=1.0).contains(&v)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:618:12
    |
618 |         if value < 0 || value > ffi::GST_FORMAT_PERCENT_MAX {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(0..=ffi::GST_FORMAT_PERCENT_MAX).contains(&value)`
    |
    = note: `#[warn(clippy::manual_range_contains)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:687:12
    |
687 |         if v < 0.0 || v > 1.0 {
    |            ^^^^^^^^^^^^^^^^^^ help: use: `!(0.0..=1.0).contains(&v)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

warning: manual `!RangeInclusive::contains` implementation
   --> gstreamer/src/format.rs:702:12
    |
702 |         if v < 0.0 || v > 1.0 {
    |            ^^^^^^^^^^^^^^^^^^ help: use: `!(0.0..=1.0).contains(&v)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains

Even though this is definitely less error prone and ranges are clear, the whole !(...).contains(&v) around it makes it more messy than I'd like it to be.

Merge request reports