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

Possible false positive for redundant_closure_call #4705

Closed
nico-abram opened this issue Oct 20, 2019 · 2 comments
Closed

Possible false positive for redundant_closure_call #4705

nico-abram opened this issue Oct 20, 2019 · 2 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@nico-abram
Copy link
Contributor

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fd3adf287da8d4e6ee17a97aec2ec8be

Code:

#[allow(clippy::identity_op)]
#[inline]
fn fill_output_color(output_texture: &mut [u8], idx: usize, color: u16) {
    let r = ((color >> 0) & 0x001F) as u8;
    let g = ((color >> 5) & 0x001F) as u8;
    let b = ((color >> 10) & 0x001F) as u8;

    let col5_to_col8 = |x| (x << 3) | (x >> 2);
    output_texture[(idx * 3) + 0] = col5_to_col8(r); // Lint triggered here
    output_texture[(idx * 3) + 1] = col5_to_col8(g);
    output_texture[(idx * 3) + 2] = col5_to_col8(b);
}
@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Oct 21, 2019
@ghost
Copy link

ghost commented Oct 22, 2019

Is this a duplicate of #3354?

@flip1995
Copy link
Member

Duplicate of #3354

Thanks for noticing @mikerite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

2 participants