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

fix manual ascii checks #835

Conversation

pawel-big-lebowski
Copy link
Contributor

@pawel-big-lebowski pawel-big-lebowski commented Mar 13, 2023

manual_is_ascii_check was added in 1.67.0. Example:

fn main() {
    assert!(matches!('x', 'a'..='z'));
    assert!(matches!(b'X', b'A'..=b'Z'));
    assert!(matches!('2', '0'..='9'));
    assert!(matches!('x', 'A'..='Z' | 'a'..='z'));

    ('0'..='9').contains(&'0');
    ('a'..='z').contains(&'a');
    ('A'..='Z').contains(&'A');
}

Use instead:

fn main() {
    assert!('x'.is_ascii_lowercase());
    assert!(b'X'.is_ascii_uppercase());
    assert!('2'.is_ascii_digit());
    assert!('x'.is_ascii_alphabetic());

    '0'.is_ascii_digit();
    'a'.is_ascii_lowercase();
    'A'.is_ascii_uppercase();
}

I think this is the cause of failing lint for PRs:

@coveralls
Copy link

coveralls commented Mar 13, 2023

Pull Request Test Coverage Report for Build 4403042910

  • 39 of 39 (100.0%) changed or added relevant lines in 12 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 86.113%

Files with Coverage Reduction New Missed Lines %
src/parser.rs 1 82.99%
Totals Coverage Status
Change from base Build 4374743456: -0.02%
Covered Lines: 13481
Relevant Lines: 15655

💛 - Coveralls

@pawel-big-lebowski pawel-big-lebowski force-pushed the fix-ci-manual-is-ascii-check branch 3 times, most recently from 270f701 to 43b4682 Compare March 13, 2023 08:48
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
@ankrgyl
Copy link
Contributor

ankrgyl commented Mar 18, 2023

Can you add some test cases that demonstrate the need for this change?

@alamb
Copy link
Collaborator

alamb commented Mar 18, 2023

Can you add some test cases that demonstrate the need for this change?

I think this change is needed because the new version of clippy got stricter and the CI checks run on the latest rust language version

Thus clippy will fail on CI unless this is fixed

@alamb
Copy link
Collaborator

alamb commented Mar 18, 2023

I thought these changes were already made in #832

@pawel-big-lebowski
Copy link
Contributor Author

This was fixed in the meantime within other PR. closing.

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

Successfully merging this pull request may close these issues.

None yet

4 participants