Skip to content

cast_possible_truncation warning message incorrect #10325

Closed
@isaacg1

Description

@isaacg1

The warning message of cast_possible_truncation incorrectly refers to cast_precision_loss.

Example code:

#[warn(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
fn main() {
    let x: u16 = 0;
    println!("{}", x as u8);
}

The warning message contains the line:

  = help: if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...

This message is produced by this line of code:

diag.help("if this is intentional allow the lint with `#[allow(clippy::cast_precision_loss)]` ...");

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