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

Rewrite ... as ..= as a MachineApplicable 2018 idiom lint #55852

Merged
merged 2 commits into from
Nov 15, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Nov 10, 2018

Fixes #51043.

@rust-highfive
Copy link
Collaborator

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2018
@varkor varkor changed the title Rewrite ... as ..= as a MachineApplicable 2018 idiom lint Rewrite ... as ..= as a MachineApplicable 2018 idiom lint Nov 10, 2018
@rust-highfive

This comment has been minimized.

Copy link
Member

@zackmdavis zackmdavis left a 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
Copy link
Member

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)

Copy link
Member Author

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.

@zackmdavis
Copy link
Member

r? @zackmdavis

@bors r+

@bors
Copy link
Contributor

bors commented Nov 10, 2018

📌 Commit c63df7c has been approved by zackmdavis

@rust-highfive rust-highfive assigned zackmdavis and unassigned cramertj Nov 10, 2018
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2018
@zackmdavis zackmdavis added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 10, 2018
@zackmdavis
Copy link
Member

Do we want to slip this into 1.31?

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 12, 2018
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint

Fixes rust-lang#51043.
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 15, 2018
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint

Fixes rust-lang#51043.
bors added a commit that referenced this pull request Nov 15, 2018
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
@nagisa
Copy link
Member

nagisa commented Nov 15, 2018

Accepted for a backport to beta.

@nagisa nagisa added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 15, 2018
@bors bors merged commit c63df7c into rust-lang:master Nov 15, 2018
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Nov 15, 2018
bors bot added a commit to rust-lang/rust-clippy that referenced this pull request Nov 15, 2018
3431: rustup rust-lang/rust#55852 r=flip1995 a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 15, 2018
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
````
@matthiaskrgr
Copy link
Member

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

bors added a commit that referenced this pull request Nov 15, 2018
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
````
@pietroalbini pietroalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 15, 2018
bors added a commit that referenced this pull request Nov 15, 2018
[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
@pietroalbini pietroalbini added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 15, 2018
@pietroalbini
Copy link
Member

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.

@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 19, 2018
@alexcrichton alexcrichton added this to the Rust 2018 Release milestone Nov 19, 2018
@nikomatsakis nikomatsakis mentioned this pull request Nov 20, 2018
20 tasks
alexcrichton pushed a commit to rust-lang/rust-clippy that referenced this pull request Nov 20, 2018
bors added a commit that referenced this pull request Nov 20, 2018
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)
@varkor varkor deleted the dotdotequals-lint branch April 17, 2019 15:12
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 5, 2020
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
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants