Skip to content

Conversation

ebroto
Copy link
Contributor

@ebroto ebroto commented May 27, 2020

If the feature is not enabled, calling is_empty() on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the ExactSizeIterator trait.

Since len_zero only checks for existing is_empty() inherent methods, we only take into account the range_is_empty feature.

Related: rust-lang/rust#48111 (comment)

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807

@rust-highfive
Copy link

r? @matthiaskrgr

(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 May 27, 2020
@ebroto ebroto force-pushed the len_zero_ranges branch from d5a5ad6 to 64a05f5 Compare May 27, 2020 22:59
@flip1995
Copy link
Member

@bors r=matthiaskrgr

@bors
Copy link
Contributor

bors commented May 28, 2020

📌 Commit 64a05f5 has been approved by matthiaskrgr

@bors
Copy link
Contributor

bors commented May 28, 2020

⌛ Testing commit 64a05f5 with merge ebfbe2b...

bors added a commit that referenced this pull request May 28, 2020
len_zero: skip ranges if feature `range_is_empty` is not enabled

If the feature is not enabled, calling `is_empty()` on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the `ExactSizeIterator` trait.

Since `len_zero` only checks for existing `is_empty()` inherent methods, we only take into account the `range_is_empty` feature.

Related: rust-lang/rust#48111 (comment)

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807
@bors
Copy link
Contributor

bors commented May 28, 2020

💔 Test failed - checks-action_test

@matthiaskrgr
Copy link
Member

Looks like we need another rustup https://github.com/rust-lang/rust-clippy/runs/716588484#step:12:43

@matthiaskrgr matthiaskrgr added S-waiting-on-bors Status: The marked PR was approved and is only waiting bors and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 28, 2020
@flip1995
Copy link
Member

I wait until rust-lang/rust#72671 is merged and will then do the rustup.

bors added a commit that referenced this pull request May 31, 2020
Rollup of 3 pull requests

Successful merges:

 - #5637 (new lint: vec_resize_to_zero)
 - #5656 (len_zero: skip ranges if feature `range_is_empty` is not enabled)
 - #5663 (add testcase that no longer ICEs)

Failed merges:

r? @ghost

changelog: rollup
bors added a commit that referenced this pull request May 31, 2020
Rollup of 3 pull requests

Successful merges:

 - #5637 (new lint: vec_resize_to_zero)
 - #5656 (len_zero: skip ranges if feature `range_is_empty` is not enabled)
 - #5663 (add testcase that no longer ICEs)

Failed merges:

r? @ghost

changelog: rollup
@bors bors merged commit 873c9fc into rust-lang:master May 31, 2020
@ebroto ebroto deleted the len_zero_ranges branch May 31, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

len_zero with Range suggests code cannot compile
5 participants