rust-lang / rust-lang/rust-clippy

Warn on unnecessary coercions

Open
#3,526 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint E-medium
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Here the as *const i32 coercion is unnecessary, but no warning is emitted.

fn foo(_x: *const i32) {}

pub fn bar(x: &mut i32) {
    foo(x as *const i32)
}

pub fn baz(x: &mut i32) {
    foo(x)
}

cc @oli-obk

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no files, tests, or entry points. Start by reproducing the Rust example in rust-clippy, then identify the appropriate lint and test location; done means the unnecessary as *const i32 form emits a warning while the direct call remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.