Skip to content
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

Use span_lint_and_sugg instead of span_lint in unnecessary_cast #6874

Closed
Y-Nak opened this issue Mar 9, 2021 · 1 comment · Fixed by #6895
Closed

Use span_lint_and_sugg instead of span_lint in unnecessary_cast #6874

Y-Nak opened this issue Mar 9, 2021 · 1 comment · Fixed by #6895
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy

Comments

@Y-Nak
Copy link
Contributor

Y-Nak commented Mar 9, 2021

The lines below should be replaced by span_lint_and_sugg or lint_unnecessary_cast as another part of unnecessary_cast does.

span_lint(
cx,
UNNECESSARY_CAST,
expr.span,
&format!(
"casting to the same type is unnecessary (`{}` -> `{}`)",
cast_from, cast_to
),
);

@Y-Nak

This comment has been minimized.

@rustbot rustbot added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy labels Mar 9, 2021
@Y-Nak Y-Nak changed the title Use span_and_sugg in unnecessary_cast instead of span_lint Use span_and_sugg instead of span_lint in unnecessary_cast Mar 9, 2021
@Y-Nak Y-Nak changed the title Use span_and_sugg instead of span_lint in unnecessary_cast Use span_lint_and_sugg instead of span_lint in unnecessary_cast Mar 9, 2021
bors added a commit that referenced this issue Mar 9, 2021
Refactor casts lint

Ref: #6724

Changes:
1. Separate the `casts` group from the `types` group.
2. Reorganize the lints of the `casts` group into their own modules.

Notes:
1. I didn't `fix` #6874 in order to maintain this PR as small as possible.

---
changelog: none
@bors bors closed this as completed in 52c25e9 Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants