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

Lint pass to warn about integer suffixes #3307

Closed
catamorphism opened this issue Aug 30, 2012 · 8 comments
Closed

Lint pass to warn about integer suffixes #3307

catamorphism opened this issue Aug 30, 2012 · 8 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@catamorphism
Copy link
Contributor

A lint pass to warn about 42u and such would be great, since the suffixes are no longer necessary.

@eholk
Copy link
Contributor

eholk commented Sep 11, 2012

The programmer may want a shorthand way to say "I really want this to be unsigned" though. I guess they could say let x : uint = 42, but I'd personally rather write let x = 42u.

@catamorphism
Copy link
Contributor Author

That's why it'll just be a lint pass and not an error :-)

@eholk
Copy link
Contributor

eholk commented Sep 11, 2012

Okay, then I'd vote for off by default :)

@Aatch
Copy link
Contributor

Aatch commented May 21, 2013

Nominating for production-ready.

@graydon
Copy link
Contributor

graydon commented May 22, 2013

Yeah, I don't know; this doesn't even really seem like a code smell to me, just a normal style choice, like variable naming or annotating-or-not each local variable type. They're totally necessary in some cases, and are shorter than type annotations.

Maybe it's just a question of the limit of what we consider "lint", but ISTM this path leads to a lint mode for every possible AST construct, and each lint pass does take a (small) amount of time to walk the AST of every function. They're not fused.

In any case, I don't feel this should block "production ready"

@bstrie
Copy link
Contributor

bstrie commented May 22, 2013

This is also very easy to grep for, if necessary.

@graydon
Copy link
Contributor

graydon commented Jun 20, 2013

just a bug, removing milestone/nomination.

@bstrie
Copy link
Contributor

bstrie commented Jul 12, 2013

Closing; this seems sufficiently innocuous that it doesn't really scream for a lint pass. Reopen if you feel otherwise.

@bstrie bstrie closed this as completed Jul 12, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 14, 2020
This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see rust-lang#3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.
flip1995 added a commit to flip1995/rust that referenced this issue Jul 14, 2020
Move range_minus_one to pedantic

This moves the range_minus_one lint to the pedantic category, so there
will not be any warnings emitted by default. This should work around
problems where the suggestion is impossible to resolve due to the range
consumer only accepting a specific range implementation, rather than the
`RangeBounds` trait (see rust-lang#3307).

While it is possible to work around this by extracting the boundary into
a variable, I don't think clippy should encourage people to disable or
work around lints, but instead the lints should be fixable. So hopefully
this will help until a proper implementation checks what the range is
used for.

*Please keep the line below*
changelog: move [`range_minus_one`] to pedantic
RalfJung pushed a commit to RalfJung/rust that referenced this issue Feb 25, 2024
tests/pass/concurrency/sync: try to make it less likely for the test to fail on macOS

We're already sleeping a full second though. How can our test be stalled for an entire second, what are these CI runners doing?!?
jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
The rust type inference for closures doesn't work in the particular use
case we are using it for ensures clauses. By creating a helper function,
we change the path the rust type inference takes and lets the type of
the closure be identified properly. This means type annotations are no
longer required within ensures clauses.

Resolves rust-lang#3304

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants