Skip to content

reverse-string: lints do not check for conditional compilation #20

Open
@drmason13

Description

@drmason13

As an example, my solution resulted in the comment "Consider expanding the solution to pass the feature-gated test_grapheme_clusters test case..."

#[cfg(feature = "grapheme")]
use unicode_segmentation::UnicodeSegmentation;

#[cfg(not(feature = "grapheme"))]
pub fn reverse(input: &str) -> String {
    input.chars().rev().collect()
}

#[cfg(feature = "grapheme")]
pub fn reverse(input: &str) -> String {
    input.graphemes(true).rev().collect()
}

I assume the #[cfg()] blocks are tripping it up. I'm afraid I don't have a suggestion for fixing this but I'm sure it's an interesting challenge for someone to tackle at some point :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions