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

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

Open
drmason13 opened this issue Jul 14, 2020 · 0 comments
Open

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

drmason13 opened this issue Jul 14, 2020 · 0 comments

Comments

@drmason13
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant