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

unreadable_literal is annoying for hex numbers #2842

Open
vks opened this issue Jun 13, 2018 · 3 comments
Open

unreadable_literal is annoying for hex numbers #2842

vks opened this issue Jun 13, 2018 · 3 comments

Comments

@vks
Copy link
Contributor

vks commented Jun 13, 2018

When having hex literals in code, conciseness is usually more important than readability, so the lint seems to be counter-productive in such cases.

@flip1995
Copy link
Member

Do you have some examples for this? IMO this lint suggests more readable Hex-literals (most of the time).

@newpavlov
Copy link

newpavlov commented Oct 3, 2018

For example in RustCrypto crates we selectively disable unreadable_literal for most of the constants. I just don't see the point in making files like this more "readable".

@flip1995
Copy link
Member

flip1995 commented Oct 3, 2018

Yeah making walls of hex-literals more readable doesn't really make sense. But I would say this is an edge case, since you shouldn't have things like this spread around in your code, but only in a few special files. Disabling the lint in those files seems reasonable to me.

This lint aims more on single literals in your Code, like

const IM_A_FLAG: u16 = 0x00FF8000;
vs
const IM_A_READABLE_FLAG: u16 = 0x00FF_8000;

IMO the second version is nicer.

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

No branches or pull requests

3 participants