Skip to content

Output of Encode/Decode macros does not pass trivial_numeric_casts lint #740

Open
@0x009922

Description

@0x009922

Versions:

  • Rust: 1.87.0
  • parity-scale-codec: 3.7.5

This code:

use parity_scale_codec::{Encode, Decode};

#[derive(Encode, Decode)]
pub enum Test {
    One,
    Two
}

Produces these errors:

error: trivial numeric cast: `usize` as `usize`
 --> src/lib.rs:5:5
  |
5 |     One,
  |     ^^^
  |
  = help: cast can be replaced by coercion; this might require a temporary variable
  = note: requested on the command line with `-D trivial-numeric-casts`

error: trivial numeric cast: `usize` as `usize`
 --> src/lib.rs:6:5
  |
6 |     Two
  |     ^^^
  |
  = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial numeric cast: `usize` as `usize`
 --> src/lib.rs:5:5
  |
5 |     One,
  |     ^^^
  |
  = help: cast can be replaced by coercion; this might require a temporary variable

error: could not compile `parity-scale-trivial-num-casts-issue` (lib) due to 4 previous errors

Full reproduction: https://github.com/0x009922/parity-scale-trivial-num-casts-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions