-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add autofixable suggestion for unseparated integer literal suffixes #4401
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
Add autofixable suggestion for unseparated integer literal suffixes #4401
Conversation
ae6d1c8
to
0922682
Compare
You could split up the test case in tests especially for this lint and the other tests. This would also help with #2038. ;) |
Okay, will do 👍 Was just checking that this is only a test issue and not something end users will notice |
0922682
to
a388a0b
Compare
No longer WIP, assuming this CI passes :) |
a388a0b
to
802a6d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
35bfe1e
to
4ee9d02
Compare
@flip1995 Should this lint on constant literals only? I tried to improve this lint too |
An error message: ---- [ui] ui/filter_map_next.rs stdout ----
normalized stderr:
error: LIT: Lit { token: Lit { kind: Integer, symbol: 7, suffix: Some(u32) }, node: Int(7, Unsigned(u32)), span: Span { lo: BytePos(180), hi: BytePos(209), ctxt: #0 } }
--> $DIR/filter_map_next.rs:7:5
|
LL | assert_eq!(element, Some(1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
help: SPAN: Span { lo: BytePos(180), hi: BytePos(209), ctxt: #0 }
|
LL | assert_eq!(element, Some(1_u32
| Edit: Because I removed these 2 lines: rust-clippy/clippy_lints/src/misc_early.rs Lines 395 to 396 in 918d609
|
There's probably something weird going with the macro expansion. I can't really tell what exactly, without seeing all of your changes.
I'm not sure if I understand your question correctly. Literals are always constant, since they're always one of a literal string ( |
@bors r+ |
📌 Commit 370433f has been approved by |
…p1995 Add autofixable suggestion for unseparated integer literal suffixes changelog: Add autofixable suggestion for unseparated integer literal suffixes Somewhat WIP, since I haven't been able to get this working when adding `// run-rustfix` to `ui/literals.rs`. I think the issue is that there are multiple suggestions operating on one numerical literal, and I'm not sure what the best approach is to work around that. Thanks
☀️ Test successful - checks-travis, status-appveyor |
Cleaner code for unsep literals Continuing discussion in #4401 (comment) changelog: none r? @flip1995
changelog: Add autofixable suggestion for unseparated integer literal suffixes
Somewhat WIP, since I haven't been able to get this working when adding
// run-rustfix
toui/literals.rs
. I think the issue is that there are multiple suggestions operating on one numerical literal, and I'm not sure what the best approach is to work around that.Thanks