-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rewrite ...
as ..=
as a MachineApplicable
2018 idiom lint
#55852
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
...
as ..=
as a MachineApplicable 2018 idiom lint...
as ..=
as a MachineApplicable
2018 idiom lint
This comment has been minimized.
This comment has been minimized.
420689f
to
c148714
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!!
| | ||
LL | &0...9 => {} | ||
| ^^^ help: use `..=` for an inclusive range | ||
| ^^^^^^ help: use `..=` for an inclusive range |
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.
In the case where we recommend parentheses (and only then), I think we want to use span_suggestion_with_applicability
(rather than span_suggestion_short_with_applicability
), because that'll print the corrected code snippet after the span message (whereas the short
variant methods omit it):
LL | &0...9 => {}
| ^^^^^^ help: use `..=` for an inclusive range: &(0..=9)
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.
Ah, that's a good point.
r? @zackmdavis @bors r+ |
📌 Commit c63df7c has been approved by |
Do we want to slip this into 1.31? |
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint Fixes rust-lang#51043.
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint Fixes rust-lang#51043.
Rollup of 17 pull requests Successful merges: - #55182 (Redox: Update to new changes) - #55211 (Add BufWriter::buffer method) - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation) - #55530 (Speed up String::from_utf16) - #55556 (Use `Mmap` to open the rmeta file.) - #55622 (NetBSD: link libstd with librt in addition to libpthread) - #55750 (Make `NodeId` and `HirLocalId` `newtype_index`) - #55778 (Wrap some query results in `Lrc`.) - #55781 (More precise spans for temps and their drops) - #55785 (Add mem::forget_unsized() for forgetting unsized values) - #55852 (Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint) - #55865 (Unix RwLock: avoid racy access to write_locked) - #55901 (fix various typos in doc comments) - #55926 (Change sidebar selector to fix compatibility with docs.rs) - #55930 (A handful of hir tweaks) - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`) - #55956 (add tests for some fixed ICEs) Failed merges: r? @ghost
Accepted for a backport to beta. |
3431: rustup rust-lang/rust#55852 r=flip1995 a=matthiaskrgr Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
Fixes clippy toolstate. Changes: ```` rustup rust-lang#55852 Fix "too" -> "foo" typo in format.rs Fix `use_self` violation Fix wrong suggestion for `redundant_closure_call` Check for common metadata Fix `use_self` false positive on `use` statements Fix `use_self` false positive Remove `+` from `has_unary_equivalent` Fix dogfood Update println! formatting Fix false positive in check mode caused by `gen_deprecated` RIIR update lints: Add check mode (update_lints.py rewrite complete) changed into_iter to iter and fixed a lint check Fix `collapsible_if` error Fix `possible_missing_comma` false positives format code fix comment spacing change single char str to char add lint to lintarray macro Revert "small fix" small fix added float support for mistyped literal lints tmp progress ````
Note: this broke clippy on nightly so it might also break clippy on beta. https://github.com/rust-lang-nursery/rust-clippy/pull/3431/files |
submodules: update clippy from d8b4269 to 7e0ddef Fixes clippy toolstate. Changes: ```` rustup #55852 Fix "too" -> "foo" typo in format.rs Fix `use_self` violation Fix wrong suggestion for `redundant_closure_call` Check for common metadata Fix `use_self` false positive on `use` statements Fix `use_self` false positive Remove `+` from `has_unary_equivalent` Fix dogfood Update println! formatting Fix false positive in check mode caused by `gen_deprecated` RIIR update lints: Add check mode (update_lints.py rewrite complete) changed into_iter to iter and fixed a lint check Fix `collapsible_if` error Fix `possible_missing_comma` false positives format code fix comment spacing change single char str to char add lint to lintarray macro Revert "small fix" small fix added float support for mistyped literal lints tmp progress ````
[beta] Rollup backports Merged and approved: * #55947: xLTO: Don't pass --plugin-opt=thin to LLD. That's not supported anymore. * #55852: Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint * #55800: Fix ICE in `return_type_impl_trait` * #55630: resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition r? @ghost
Clippy needs to be updated on the beta branch to cherry-pick rust-lang/rust-clippy#3431 if you want to backport this to beta. |
beta backport rollup Backports of some beta-approved PRs - [x] #55385: NLL: cast causes failure to promote to static - [x] #56043: remove "approx env bounds" if we already know from trait - [x] #56003: do not propagate inferred bounds on trait objects if they involve `Self` - [x] #55852: Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint - [x] #55804: rustdoc: don't inline `pub use some_crate` unless directly asked to - [x] #56059: Increase `Duration` approximate equal threshold to 1us - [x] Keep resolved defs in path prefixes and emit them in save-analysis #54145 - [x] Adjust Ids of path segments in visibility modifiers #55487 - [x] save-analysis: bug fix and optimisation. #55521 - [x] save-analysis: be even more aggressive about ignorning macro-generated defs #55936 - [x] save-analysis: fallback to using path id #56060 - [x] save-analysis: Don't panic for macro-generated use globs #55879 - [x] Add temporary renames to manifests for rustfmt/clippy #56081 - [x] Revert #51601 #56049 - [x] Fix stability hole with `static _` #55983 - [x] #56077 - [x] Fix Rustdoc ICE when checking blanket impls #55258 - [x] Updated RELEASES.md for 1.31.0 #55678 - [x] ~~#56061~~ #56111 - [x] Stabilize `extern_crate_item_prelude` #56032 Still running tests locally, and I plan to backport @nrc's other PRs too (cc @petrochenkov -- thanks for the advice)
Fixes clippy toolstate. Changes: ```` rustup rust-lang/rust#55852 Fix "too" -> "foo" typo in format.rs Fix `use_self` violation Fix wrong suggestion for `redundant_closure_call` Check for common metadata Fix `use_self` false positive on `use` statements Fix `use_self` false positive Remove `+` from `has_unary_equivalent` Fix dogfood Update println! formatting Fix false positive in check mode caused by `gen_deprecated` RIIR update lints: Add check mode (update_lints.py rewrite complete) changed into_iter to iter and fixed a lint check Fix `collapsible_if` error Fix `possible_missing_comma` false positives format code fix comment spacing change single char str to char add lint to lintarray macro Revert "small fix" small fix added float support for mistyped literal lints tmp progress ````
Fixes #51043.