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

Catch typos like 1_32 instead of 1_i32 #3091

Closed
scottmcm opened this issue Aug 27, 2018 · 4 comments
Closed

Catch typos like 1_32 instead of 1_i32 #3091

scottmcm opened this issue Aug 27, 2018 · 4 comments
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group

Comments

@scottmcm
Copy link
Member

I missed a letter in a very subtle way that still compiled, so it might be a good candidate for linting:

let mut x = 1_32;

when I meant to type

let mut x = 1_i32;

This, of course, made it do something very different from what I wanted...

@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints L-correctness Lint: Belongs in the correctness lint group labels Aug 27, 2018
@mipli
Copy link
Contributor

mipli commented Sep 2, 2018

Just had an issue with this myself, so I wouldn't mind solving this one.

Been looking a bit into it, and thinking that it would fit to add it as another lint in the clippy_lints/src/literal_representation.rs file.

What I'm wondering though is what the name of the new lint should be. misstyped_literal, misstyped_literal_suffix?

And I'm assuming it should go into the correctness group, due to the label on this issue.

@flip1995
Copy link
Member

flip1995 commented Sep 2, 2018

Been looking a bit into it, and thinking that it would fit to add it as another lint in the clippy_lints/src/literal_representation.rs file.

Yes sounds good!

I think misstyped_literal_suffix is a good name for this.

correctness feels like the right lint group for this.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 3, 2018

Naming conventions say it should be mistyped_literal_suffixes so allow(mistyped_literal_suffixes) sounds like an english sentence

@dtolnay
Copy link
Member

dtolnay commented Nov 21, 2018

Added in #3129.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group
Projects
None yet
Development

No branches or pull requests

6 participants