Skip to content

cast_possible_truncation warning message incorrect #10325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isaacg1 opened this issue Feb 12, 2023 · 0 comments · Fixed by #10330
Closed

cast_possible_truncation warning message incorrect #10325

isaacg1 opened this issue Feb 12, 2023 · 0 comments · Fixed by #10330

Comments

@isaacg1
Copy link

isaacg1 commented Feb 12, 2023

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)]` ...");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant