Skip to content

clippy::unnecessary_cast does not warn on basic usage #9562

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
frewsxcv opened this issue Oct 1, 2022 · 2 comments · Fixed by #9576
Closed

clippy::unnecessary_cast does not warn on basic usage #9562

frewsxcv opened this issue Oct 1, 2022 · 2 comments · Fixed by #9576
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Oct 1, 2022

Summary

When casting the result of a function to the same type, clippy::unnecessary_cast doesn't warn

Lint Name

clippy::unnecessary_cast

Reproducer

I tried this code:

fn foo() -> f32 { 0. }

fn main() {
    let num = foo() as f32;
}

I expected to see this happen: Warning that the cast is unnecessary

Instead, this happened: No warning

Version

No response

@frewsxcv frewsxcv added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Oct 1, 2022
@TennyZhuang
Copy link
Contributor

@bors claim

@xFrednet
Copy link
Member

xFrednet commented Oct 2, 2022

Issue actions are done with @rustbot. So @rustbot claim would have worked. Now I can assign you directly. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants