rust-lang / rust-lang/rust-clippy
uninit_assumed_init lint does not recognize trivial misuse
Open
Nobody has claimed this yet.
C-enhancement
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
uninit_assumed_init lint (see #4272) correctly recognizes the following anti-pattern:
unsafe { let mut x = MaybeUninit::<&i32>::uninit().assume_init(); }
However, it does not recognize a slightly altered version of it:
let mut x = MaybeUninit::<&i32>::uninit();
let x = unsafe { x.assume_init() };
Clippy version: clippy 0.0.212 (c8e3cfb 2019-10-28)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two Rust examples and inspect the uninit_assumed_init lint implementation introduced by #4272. Done means the lint recognizes both the direct and the separated assume_init forms without losing the existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100