rust-lang / rust-lang/rust-clippy

Lint against calling intrinsics that have stable or safe wrappers

Open
#2,997 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint good first issue L-suggestion L-unnecessary
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

There are some intrinsics that there should be no reason to call. For example core::intrinsics::size_of. This intrinsic is exposed by the safe function core::mem::size_of which should always be called instead.

I would like to suggest a Clippy lint that notices calls to no-reason-to-call intrinsics and recommends the right stable or safe wrapper to call instead.

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

Start by reviewing the issue's examples of core::intrinsics::size_of and its core::mem::size_of wrapper, then determine which other intrinsics qualify as having stable or safe wrappers. Done means Clippy detects those calls and recommends the appropriate wrapper, with the supported intrinsic set and behavior defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.