Skip to content

False positive when swapping elements of a matrix #4853

Closed
@krishna-veerareddy

Description

@krishna-veerareddy

Clippy(clippy 0.0.212 (3aea860 2019-09-03)) incorrectly suggests to use std::mem::swap when trying to swap elements of a matrix across different rows. The lint is clippy::manual_swap.

Here's a minimal example:

fn swap(a: &mut[Vec<u64>]) {
    let tmp = a[0][1];

    a[0][1] = a[1][0];
    a[1][0] = tmp;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions