Skip to content

Unable to allow same_item_push on beta and released Rust version #6002

Closed
@bgurney-rh

Description

@bgurney-rh

As part of preparing devicemapper-rs in Stratis for the 1.46 release, I was addressing a lint error message from clippy that appears to be a false one, since it's on a non-constant value (which would correspond to issue #5902).

(Related pull request from devicemapper-rs: stratis-storage/devicemapper-rs#576)

"rustup default beta" (rustc 1.47.0-beta.1)
...
error: it looks like the same item is being pushed into this Vec
   --> src/core/dm.rs:582:17
    |
582 |                 targets.push((targ.sector_start, targ.length, target_type, params));
    |                 ^^^^^^^
    |
    = note: `-D clippy::same-item-push` implied by `-D warnings`
    = help: try using vec![(targ.sector_start, targ.length, target_type, params);SIZE] or targets.resize(NEW_SIZE, (targ.sector_start, targ.length, target_type, params))
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push

As part of continuous integration testing, clippy is executed on both the beta, and the released version. However, in the case of 1.46.0, and same_item_push, the lint cannot be found in the released version:

"rustup default 1.46.0" (1.46.0-x86_64-unknown-linux-gnu)
...
error: unknown clippy lint: clippy::same_item_push
   --> src/core/dm.rs:558:13
    |
558 |     #[allow(clippy::same_item_push)]
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::unknown-clippy-lints` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
    Checking tempfile v3.1.0
error: aborting due to previous error

For now, we changed the allow to #[allow(clippy::all)], but it would be preferable to be able to allow the specific lint on both the beta and released version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions