Skip to content

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

Closed
@frewsxcv

Description

@frewsxcv

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

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions