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

decimal constant error #1274

Closed
fabricedesre opened this issue Oct 11, 2016 · 4 comments
Closed

decimal constant error #1274

fabricedesre opened this issue Oct 11, 2016 · 4 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@fabricedesre
Copy link

It looks like clippy is being confused by decimal in r# strings part of a macro:

error: this is a decimal constant
--> components/core/src/utils.rs:128:55
|
128 | assert_eq!(json!([1, 100, 1000]), r#"[1,100,1000]"#);
| ^
|
note: lint level defined here
--> components/core/src/lib.rs:10:9
|
10 | #![deny(clippy)]
| ^^^^^^
help: if you mean to use a decimal constant, remove the 0 to remove confusion:
| assert_eq!(json!([1, 100, 1000]), r#"[1,10,1000]"#);
help: if you mean to use an octal constant, use 0o:
| assert_eq!(json!([1, 100, 1000]), r#"[1,100o,1000]"#);
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#zero_prefixed_literal

error: aborting due to previous error

error: Could not compile foxbox_core.

@mcarton
Copy link
Member

mcarton commented Oct 11, 2016

That's a weird one 😕
That lint only checks for LitKind::Int.
I can't reproduce it, can you reduce it to a self-contained example? Or publish the full code that triggers that?

@mcarton mcarton added the C-bug Category: Clippy is not doing the correct thing label Oct 11, 2016
@mcarton
Copy link
Member

mcarton commented Oct 11, 2016

Oh I know, the problem is from json! but at no point we ever check for macros in that lint and we look at snippets.
@fabricedesre what crate does json! come from?

@fabricedesre
Copy link
Author

It's not from a published crate, but from: https://github.com/fxbox/foxbox/blob/master/components/core/src/utils.rs#L18

@phansch
Copy link
Member

phansch commented Dec 18, 2020

Going to close this issue as the lint doesn't trigger anymore these days: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=458c92788f0b6472ea3f6f6bf910b3a2

@phansch phansch closed this as completed Dec 18, 2020
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
Projects
None yet
Development

No branches or pull requests

3 participants