cryspen / cryspen/bertie

Clippy: Fix "this is a decimal constant"

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
F*
Stars
138
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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]))?;
|
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.