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

Circumvent clippy::octal_escapes lint in generated literals #380

Merged
merged 4 commits into from
Apr 3, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Apr 3, 2023

Closes #363.

    error: octal-looking escape in string literal
       --> tests/test.rs:118:25
        |
    118 |         Literal::string("a\00b\07c\08d\0e\0").to_string(),
        |                         ^^^^^^^^^^^^^^^^^^^^
        |
        = help: octal escapes are not supported, `\0` is always a null character
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#octal_escapes
        = note: `-D clippy::octal-escapes` implied by `-D clippy::all`
    help: if an octal escape was intended, use the hexadecimal representation instead
        |
    118 |         Literal::string("a\x00b\x07c\08d\0e\0").to_string(),
        |                         ~~~~~~~~~~~~~~~~~~~~~~
    help: if the null character is intended, disambiguate using
        |
    118 |         Literal::string("a\x000b\x007c\08d\0e\0").to_string(),
        |                         ~~~~~~~~~~~~~~~~~~~~~~~~

    error: octal-looking escape in byte string literal
       --> tests/test.rs:155:30
        |
    155 |         Literal::byte_string(b"a\00b\07c\08d\0e\0").to_string(),
        |                              ^^^^^^^^^^^^^^^^^^^^^
        |
        = help: octal escapes are not supported, `\0` is always a null byte
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#octal_escapes
    help: if an octal escape was intended, use the hexadecimal representation instead
        |
    155 |         Literal::byte_string(b"a\x00b\x07c\08d\0e\0").to_string(),
        |                              ~~~~~~~~~~~~~~~~~~~~~~~
    help: if the null byte is intended, disambiguate using
        |
    155 |         Literal::byte_string(b"a\x000b\x007c\08d\0e\0").to_string(),
        |                              ~~~~~~~~~~~~~~~~~~~~~~~~~
@dtolnay dtolnay merged commit 9c092a3 into master Apr 3, 2023
@dtolnay dtolnay deleted the octalescape branch April 3, 2023 06:18
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.

LitByteStr produces tokens that trigger clippy::octal-escapes
1 participant