bors [Wed, 6 Jan 2021 11:57:56 +0000 (11:57 +0000)]
Auto merge of #6554 - sozysozbot:master, r=flip1995
Fix typo: `which which can be` -> `which can be`
Fixed a typo in the explanation of https://rust-lang.github.io/rust-clippy/master/index.html#large_types_passed_by_value : `which which can be` -> `which can be`
bors [Tue, 5 Jan 2021 09:54:34 +0000 (09:54 +0000)]
Auto merge of #6542 - rail-rain:ptr_as_ptr, r=flip1995
Add a new lint `ptr_as_ptr`
This PR adds a new lint `ptr_as_ptr` which checks for `as` casts between raw pointers without changing its mutability and suggest replacing it with `pointer::cast`. Closes #5890.
Open question: should this lint be `pedantic` or `style`? I set it `pedantic` for now because the original post suggests using it, but I think the lint also fits well to `style`.
bors [Tue, 5 Jan 2021 09:37:19 +0000 (09:37 +0000)]
Auto merge of #6513 - nahuakang:fix/empty_enum_lint_never_type, r=flip1995
Fix: Empty enum never type suggested only if the feature is enabled
This PR addresses [Issue 6422](https://github.com/rust-lang/rust-clippy/issues/6422). Instead of always recommending `never type` for empty enums, Clippy would only recommend [the lint](https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum) if [LatePass.TyCtxt](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html) has `features().never_type` enabled.
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: Only trigger [`empty_enum`] lint if `never_type` feature is enabled.
bors [Tue, 5 Jan 2021 08:00:50 +0000 (08:00 +0000)]
Auto merge of #6547 - camsteffen:curse-outdated, r=phansch
Curse outdated test output
changelog: internal
Change `cargo dev bless` to only include test output that was generated since the last build of clippy. This is especially useful when running tests with `TESTNAME=...`. The feature may be disabled by `cargo dev bless --ignore-timestamp`.
bors [Mon, 4 Jan 2021 20:42:18 +0000 (20:42 +0000)]
Auto merge of #6538 - Jarcho:vec_init_then_push, r=llogiq
New lint: vec_init_then_push
fixes: #1483
This will trigger on `new`, `default`, and `with_capacity` when the given capacity is less than or equal to the number of push calls. Is there anything else this should trigger on?
bors [Sat, 2 Jan 2021 13:12:15 +0000 (13:12 +0000)]
Auto merge of #6530 - m-ou-se:2021, r=phansch
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.
Mara Bos [Fri, 1 Jan 2021 15:21:31 +0000 (16:21 +0100)]
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.
Julian Knodt [Thu, 31 Dec 2020 00:58:27 +0000 (01:58 +0100)]
first pass at default values for const generics
- 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
bors [Fri, 1 Jan 2021 09:01:32 +0000 (09:01 +0000)]
Auto merge of #6526 - matthiaskrgr:version, r=Manishearth
make clippy version number correspond to rustc version number.
clippy 0.1.50 corresponds to rustc 1.50.x
This bumps the clippy version number from 0.0.212 to 0.1.50
Fixes #6499
Notes:
I used `cargo --version` because that way we can honour the version set in the `rust-toolchain` file.
When we bump the bootstrap compiler from 1.50 to 1.51, the version numbers will have to be changed to 1.51 or the test will fail.
---
changelog: make clippy version number correspond to rustc version number (rust 1.50.0 -> clippy 0.1.50)
Mara Bos [Wed, 30 Dec 2020 20:56:58 +0000 (20:56 +0000)]
Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
Rename kw::Invalid -> kw::Empty
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.
Joshua Nelson [Wed, 30 Dec 2020 01:28:08 +0000 (20:28 -0500)]
Rename kw::Invalid -> kw::Empty
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.
bors [Wed, 23 Dec 2020 00:25:05 +0000 (00:25 +0000)]
Auto merge of #6483 - xFrednet:5386-github-ticket-search, r=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 #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>
2. Only starting the search after three letters and improving the search performance in general. (Followup #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
bors [Tue, 22 Dec 2020 15:32:45 +0000 (15:32 +0000)]
Auto merge of #6494 - matthiaskrgr:readme_, r=flip1995
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.
bors [Tue, 22 Dec 2020 12:06:08 +0000 (12:06 +0000)]
Auto merge of #6476 - 1c3t3a:1c3t3a-from-over-into, r=llogiq
Added from_over_into lint
Closes #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.
Matthias Krüger [Tue, 22 Dec 2020 00:24:59 +0000 (01:24 +0100)]
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.