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

Clippy: Fix "this is a decimal constant" #53

Open
duesee opened this issue Oct 4, 2022 · 0 comments
Open

Clippy: Fix "this is a decimal constant" #53

duesee opened this issue Oct 4, 2022 · 0 comments
Labels
question Further information is requested

Comments

@duesee
Copy link
Contributor

duesee commented Oct 4, 2022

Can we fix (not silence) all "this is a decimal constant" warnings? We discussed that some weeks ago but reached no consensus. To me, writing "3" (decimal) as "03" is SO confusing. Glad that clippy lints against that :-) I would propose to just use hex notation.

this is a decimal constant

warning: this is a decimal constant
   --> simple_https_server/src/lib.rs:132:72
    |
132 |                         .write_record(ByteSeq::from_public_slice(&[21, 03, 03, 00, 02, 2, 47]))?;
    |                                                                        ^^
    |
    = note: `#[warn(clippy::zero_prefixed_literal)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal
help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
132 |                         .write_record(ByteSeq::from_public_slice(&[21, 3, 03, 00, 02, 2, 47]))?;
    |                                                                        ~
help: if you mean to use an octal constant, use `0o`
    |
132 |                         .write_record(ByteSeq::from_public_slice(&[21, 0o3, 03, 00, 02, 2, 47]))?;
    |        
@duesee duesee added the question Further information is requested label Oct 4, 2022
@duesee duesee mentioned this issue Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant