Skip to content

Version 0.1.42 breaks code with #![deny(trivial_numeric_casts)] #6

@Pzixel

Description

@Pzixel

Minimal reproducible example

Cargo.toml

[dependencies]
num = "0.1"
num-derive = "0.1"

main.rs

#![deny(trivial_numeric_casts)]
extern crate num;
#[macro_use]
extern crate num_derive;

#[derive(FromPrimitive)]
pub enum SomeEnum {
    A = 1
}

fn main() {

}

Error:

   Compiling hello_world_clion v0.1.0 (file:///C:/Users/Alex/Documents/Rust/hello_world_clion)
error: trivial numeric cast: `isize` as `isize`. Cast can be replaced by coercion, this might require type ascription or a temporary variable
 --> src\main.rs:6:10
  |
6 | #[derive(FromPrimitive)]
  |          ^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src\main.rs:1:9
  |
1 | #![deny(trivial_numeric_casts)]
  |         ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Our project depends heavily on this deny attribute so disable it is a no-no. Currently we use num-derive = "=0.1.41" but I hope we can switch to higher version. Is seems to be an easy fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions