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

uninit_assumed_init lint does not recognize trivial misuse #4765

Open
Shnatsel opened this issue Nov 1, 2019 · 0 comments
Open

uninit_assumed_init lint does not recognize trivial misuse #4765

Shnatsel opened this issue Nov 1, 2019 · 0 comments
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@Shnatsel
Copy link
Member

Shnatsel commented Nov 1, 2019

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)

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants