Skip to content

Update Clippy #80623

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

Merged
merged 53 commits into from
Jan 3, 2021
Merged

Update Clippy #80623

merged 53 commits into from
Jan 3, 2021

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Jan 2, 2021

Biweekly Clippy update.

This includes a Cargo.lock update for the recent Clippy version bump.

r? @Manishearth

1c3t3a and others added 30 commits December 19, 2020 17:00
…t is missing on a nightly

Clippy should always be available on nightly because we are gating on it in rustcs CI.
readme: remove paragraph about installing clippy manually on ci, if it is missing on a nightly

Clippy should always be available on nightly because we are gating on it in rustcs CI.

changelog: remove outdated readme paragraph
…, r=llogiq

Don't trigger large_enum_variant in external macros

Closes rust-lang#1776 (the potential JSON output issue is not something we can fix in Clippy and I can't reproduce it anymore)

changelog: Don't trigger [`large_enum_variant`] in external macros
This most likely no longer works since we are pinning clippy on a specific nightly now.
"cargo run" would try to compile clippy with whatever version the project we want to check demands.

Also building clippy yourself to run it on a project is not really needed anymore since clippy is shipped with official rust releases.

Fixes rust-lang#6489
remove clone in manual_async_fn lint

changelog: none
Added from_over_into lint

Closes rust-lang#6456
Added a lint that searches for implementations of `Into<..>` and suggests to implement `From<..>` instead, as it comes with a default implementation of `Into`. Category: style.

changelog: added `from_over_into` lint
readme: remove paragraph about executing clippy via "cargo run .."

This most likely no longer works since we are pinning clippy on a specific nightly now.
"cargo run" would try to compile clippy with whatever version the project we want to check demands.

Also building clippy yourself to run it on a project is not really needed anymore since clippy is shipped with official rust releases.

Fixes rust-lang#6489

changelog: none
The default value for a field type does not necessarily match the
default value for that field in the struct Default.
There is already an assertion that consecutive lines assign to a struct
field.
…=ebroto

Revert "Pass Clippy args also trough RUSTFLAGS"

Reverts rust-lang/rust-clippy#6441

r? `@ebroto`

changelog: Revert "Pass Clippy args also trough RUSTFLAGS"
ci: test cargo clippy --fix -Zunstable-options

Make sure we catch cases like rust-lang/rust-clippy#6487 in CI in the future.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
…killercup

Website issue tracker link and better search performance

This PR implements some improvements to the website:
1. Added a "Search on Github" link to the "Known problems" section (Closes rust-lang#5386)
    ![example_3](https://user-images.githubusercontent.com/17087237/102718215-e9f12500-42de-11eb-8c1b-487f8184aaf7.png)
    <details>
    <summary>Another mock up I created with the GitHub logo</summary>

    ![example_2](https://user-images.githubusercontent.com/17087237/102718281-3472a180-42df-11eb-99b8-7f6d76da2b55.png)

    </details>

2. Only starting the search after three letters and improving the search performance in general. (Followup rust-lang#6477)

### Testing
These changes can be tested locally by:
1. Clone this branch
2. Download the current lint index from the [gh-pages branch](https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json)
3. Put it next to the `util/gh-pages/index.html` and open the html file. Make sure that it can load the lint data. (Browsers can be a bit iffy when opening a local html page and loading data)

### Sources for search performance:
1. [A stackoverflow about angular filter performance](https://stackoverflow.com/questions/26876514/optimize-angular-filter-performance)
    * I selected a search debounce of 50ms that's fast enough to catch fast deletion and typing but responsive enough to not bother the user
2. [A stackoverflow about string comparison speeds](https://stackoverflow.com/questions/5296268/fastest-way-to-check-a-string-contain-another-substring-in-javascript)
3. [JS benchmarks for string search performance (`indexOf` seams to be the best)](https://jsben.ch/9cwLJ)

Note: The performance is still a bit poor when going from a specific lint to no search filter. I suspect that angular is recreating all lint items when the filter is cleared causing a major lag spike. The filter functions is at least optimized for little to no search.

---

changelog: Added a "Search on GitHub" link to the website
fix ci on master branch; run the --fix test in the correct directory

Turned out the --fix test was run in the wrong directory.

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
JulianKnodt and others added 10 commits January 1, 2021 10:55
- Adds optional default values to const generic parameters in the AST
  and HIR
- Parses these optional default values
- Adds a `const_generics_defaults` feature gate
Clippy treated Rust 2021 as Rust 2015, because 2018 was checked with
`==` instead of `>=`. This fixes that, such that 2018-specific things
are also enabled for 2021.
Initial support for Rust 2021.

Clippy treated Rust 2021 as Rust 2015, because 2018 was checked with `==` instead of `>=`. This fixes that, such that 2018-specific things are also enabled for 2021.

changelog: Added support for Rust 2021.
Rustup

r? `@ghost`

changelog: none
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  EXTRA_VARIABLES: {
 "CI_ONLY_WHEN_SUBMODULES_CHANGED": 1
##[endgroup]
adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED
linux builder detected, using docker to run the build
##[group]Run src/ci/scripts/should-skip-this.sh
---
  CACHE_DOMAIN: ci-caches.rust-lang.org
  CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
  IMAGE: x86_64-gnu-tools
##[endgroup]
Executing the job since clippy subtree was updated
with:
  github_token: ***
  check_every_seconds: 60
env:
---
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s


running 2 tests
test check_that_clippy_has_the_same_major_version_as_rustc ... FAILED

failures:


---- check_that_clippy_has_the_same_major_version_as_rustc stdout ----
thread 'check_that_clippy_has_the_same_major_version_as_rustc' panicked at 'failed to run `rustc --version`: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/tools/clippy/tests/versioncheck.rs:37:14


failures:
failures:
    check_that_clippy_has_the_same_major_version_as_rustc
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s

error: test failed, to rerun pass '--test versioncheck'

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jan 2, 2021

---- check_that_clippy_has_the_same_major_version_as_rustc stdout ----
thread 'check_that_clippy_has_the_same_major_version_as_rustc' panicked at 'failed to run `rustc --version`: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/tools/clippy/tests/versioncheck.rs:37:14

Mmh, simply calling rustc does not work as part of x.py test :/

edit: feel free to temporarily disable the test. I'll need to figure out how x.py provides its rustc to the tools

@flip1995
Copy link
Member Author

flip1995 commented Jan 2, 2021

I'll need to figure out how x.py provides its rustc to the tools

@matthiaskrgr It should work with RUSTC_REAL. Let's wait for CI.

@matthiaskrgr
Copy link
Member

@matthiaskrgr It should work with RUSTC_REAL. Let's wait for CI.

Does that also work with our compiletest-based setup in the clippy repo?

@flip1995
Copy link
Member Author

flip1995 commented Jan 2, 2021

I just synced back 5dd64b3 locally and it passed the Clippy test suite. So yes, this works now for both repos, rust-clippy and rust.

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 2, 2021

📌 Commit 5dd64b3 has been approved by Manishearth

@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 Jan 2, 2021
@bors
Copy link
Collaborator

bors commented Jan 3, 2021

⌛ Testing commit 5dd64b3 with merge 18d855b...

@Manishearth
Copy link
Member

@bors p=2

@bors
Copy link
Collaborator

bors commented Jan 3, 2021

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 18d855b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 3, 2021
@bors bors merged commit 18d855b into rust-lang:master Jan 3, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 3, 2021
@flip1995 flip1995 deleted the clippyup branch January 3, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.