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

needless_character_iteration false positive #12879

Closed
aDotInTheVoid opened this issue Jun 3, 2024 · 2 comments · Fixed by #12886
Closed

needless_character_iteration false positive #12879

aDotInTheVoid opened this issue Jun 3, 2024 · 2 comments · Fixed by #12886
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@aDotInTheVoid
Copy link
Member

This transformation isn't correct:

fn main() {
    let s = "Beyoncé";
    // EVERY character isn't ascii
    dbg!(s.chars().all(|c| !char::is_ascii(&c)));
    // ANY character isn't ascii
    dbg!(!s.is_ascii());
}
[src/main.rs:3:5] s.chars().all(|c| !char::is_ascii(&c)) = false
[src/main.rs:4:5] !s.is_ascii() = true

Originally posted by @aDotInTheVoid in #12815 (comment)

CC @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Thanks! Gonna send a fix in the next days.

@aDotInTheVoid
Copy link
Member Author

aDotInTheVoid commented Jun 3, 2024

@rustbot modify labels: I-false-positive C-bug

@rustbot rustbot added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Jun 3, 2024
@bors bors closed this as completed in 10d1f32 Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants