Skip to content

explicit_counter_loop false-positive when the counter is used after the loop #373

Closed
@Ms2ger

Description

@Ms2ger
                let mut character_count = 0;
                for (character_index, _) in text.char_indices() {
                    if character_index == insertion_point.index {
                        return Some(CharIndex(character_count))
                    }
                    character_count += 1
                }
                return Some(CharIndex(character_count))

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions