Skip to content

reversed_empty_ranges false positive #5808

Open
@nilgoyette

Description

@nilgoyette

As a user of ndarray, I can use negative indexing in slices, like I would do with NumPy

// A view of the image without borders
let block = image.slice(s![1..-1, 1..-1, 1..-1]);

Since Rust 1.45.0, I get this error when I run clippy: error: this range is empty so it will yield no values. This message is wrong: my code compiles and runs as intended. Clippy shouldn't only check if end <= start, it should also check if end is negative, or if it's a isize slice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions