]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoUse existing 'is_automatically_derived' helper
Philipp Hansch [Tue, 5 Jan 2021 15:31:08 +0000 (16:31 +0100)]
Use existing 'is_automatically_derived' helper

3 years agoAuto merge of #6542 - rail-rain:ptr_as_ptr, r=flip1995
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`.

---

changelog: New lint `ptr_as_ptr`

3 years agoAuto merge of #6513 - nahuakang:fix/empty_enum_lint_never_type, r=flip1995
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.

- \[ ] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`
---

*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.

3 years agoAuto merge of #6547 - camsteffen:curse-outdated, r=phansch
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`.

3 years agoFix the MSRV and add the tests for MSRV
rail [Mon, 4 Jan 2021 21:17:31 +0000 (10:17 +1300)]
Fix the MSRV and add the tests for MSRV

3 years agoAdd a new lint `ptr_as_ptr`,
rail [Sun, 3 Jan 2021 21:34:11 +0000 (10:34 +1300)]
Add 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`.

3 years agoAuto merge of #6538 - Jarcho:vec_init_then_push, r=llogiq
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?

changelog: Added lint: `vec_init_then_push`

3 years agoRun cargo dev fmt
nahuakang [Mon, 4 Jan 2021 17:41:42 +0000 (18:41 +0100)]
Run cargo dev fmt

3 years agoAddress flip1995's review comments
nahuakang [Mon, 4 Jan 2021 16:47:59 +0000 (17:47 +0100)]
Address flip1995's review comments

3 years agoAuto merge of #6548 - camsteffen:bless-internal, r=flip1995
bors [Mon, 4 Jan 2021 15:17:58 +0000 (15:17 +0000)]
Auto merge of #6548 - camsteffen:bless-internal, r=flip1995

Add ui-internal to cargo dev bless

changelog: internal

3 years agoBless only updated since clippy build
Cameron Steffen [Thu, 31 Dec 2020 16:50:00 +0000 (10:50 -0600)]
Bless only updated since clippy build

3 years agoAdd ui-internal to cargo dev bless
Cameron Steffen [Thu, 31 Dec 2020 15:50:23 +0000 (09:50 -0600)]
Add ui-internal to cargo dev bless

3 years agoAuto merge of #6507 - bengsparks:lint/issue6410, r=flip1995
bors [Mon, 4 Jan 2021 14:17:24 +0000 (14:17 +0000)]
Auto merge of #6507 - bengsparks:lint/issue6410, r=flip1995

Needless Question Mark Lint

Fixes #6410, i.e the needless question mark lint

changelog: [`needless_question_mark`] New lint

3 years agoImplemented needless question mark lint
Benjamin Sparks [Sat, 26 Dec 2020 17:02:46 +0000 (18:02 +0100)]
Implemented needless question mark lint

3 years agoAuto merge of #6544 - matthiaskrgr:else_if, r=flip1995
bors [Mon, 4 Jan 2021 12:45:51 +0000 (12:45 +0000)]
Auto merge of #6544 - matthiaskrgr:else_if, r=flip1995

collapsible_if: split collapsible_else_if into its own lint so we can enable/disable it particularly

This splits up clippy::collapsible_if into collapsible_if for
if x {
  if y { }
}
=>
if x && y { }

and collapsible_else_if for

if x {
} else {
 if y { }
}

=>
if x {

} else if y {

}

so that we can lint for only the latter but not the first if we desire.

changelog: collapsible_if: split up linting for if x {} else { if y {} } into collapsible_else_if lint

3 years agocollapsible_if: split collapsible_else_if into its own lint so we can enable/disable...
Matthias Krüger [Mon, 4 Jan 2021 07:25:38 +0000 (08:25 +0100)]
collapsible_if: split collapsible_else_if into its own lint so we can enable/disable it particularly

This splits up clippy::collapsible_if into collapsible_if for
if x {
  if y { }
}
=>
if x && y { }

and collapsible_else_if for

if x {
} else {
 if y { }
}

=>
if x {

} else if y {

}

so that we can lint for only the latter but not the first if we desire.

changelog: collapsible_if: split up linting for if x {} else { if y {} } into collapsible_else_if lint

3 years agoAuto merge of #6525 - phansch:fix-bless-in-subdirs, r=flip1995
bors [Mon, 4 Jan 2021 09:23:01 +0000 (09:23 +0000)]
Auto merge of #6525 - phansch:fix-bless-in-subdirs, r=flip1995

Fix blessing of test output in subdirectories

The core issue was the usage of `reference_file_path.file_name()`, which
provided a non-existent path if the file to be updated was in a
subdirectory.

Instead we have to provide the whole path after 'tests/ui/' as the
'filename'. This part of the path is called `test_name` in the code now.

changelog: none

3 years agoFix docs: use type inference
Jason Newcomb [Sun, 3 Jan 2021 19:04:05 +0000 (14:04 -0500)]
Fix docs: use type inference

3 years agoAuto merge of #6518 - ThibsG:CopyException, r=ebroto
bors [Sat, 2 Jan 2021 23:51:49 +0000 (23:51 +0000)]
Auto merge of #6518 - ThibsG:CopyException, r=ebroto

Ensure `Copy` exception in trait definition for `wrong_self_conventio…

Add a test case to ensure `Copy` exception is preserved also in trait definition, when passing `self` by value.

Follow up of #6316

changelog: none

3 years agoAuto merge of #6531 - matthiaskrgr:6522, r=ebroto
bors [Sat, 2 Jan 2021 23:38:23 +0000 (23:38 +0000)]
Auto merge of #6531 - matthiaskrgr:6522, r=ebroto

field_reassign_with_default: don't expand macros in suggestion

fixes #6522

changelog: field_reassign_with_default: don't expand macros in lint suggestion (#6522)

3 years agoFix lint errors
Jason Newcomb [Sat, 2 Jan 2021 19:31:21 +0000 (14:31 -0500)]
Fix lint errors

3 years agoFix clone_on_copy test
Jason Newcomb [Sat, 2 Jan 2021 16:18:04 +0000 (11:18 -0500)]
Fix clone_on_copy test

3 years agoAuto merge of #6520 - phansch:update-changelog, r=flip1995
bors [Sat, 2 Jan 2021 16:13:24 +0000 (16:13 +0000)]
Auto merge of #6520 - phansch:update-changelog, r=flip1995

Update CHANGELOG for Rust 1.50

changelog: none

r? `@flip1995`

3 years agoAdd lint
Jason Newcomb [Sat, 2 Jan 2021 16:08:56 +0000 (11:08 -0500)]
Add lint

3 years agoAuto merge of #6536 - flip1995:rustup, r=flip1995
bors [Sat, 2 Jan 2021 15:28:08 +0000 (15:28 +0000)]
Auto merge of #6536 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy version to 0.1.51
flip1995 [Sat, 2 Jan 2021 15:26:10 +0000 (16:26 +0100)]
Bump Clippy version to 0.1.51

3 years agoUse rustc --version in versioncheck
flip1995 [Sat, 2 Jan 2021 15:20:43 +0000 (16:20 +0100)]
Use rustc --version in versioncheck

3 years agoBump nightly version to 2021-01-02
flip1995 [Sat, 2 Jan 2021 15:05:54 +0000 (16:05 +0100)]
Bump nightly version to 2021-01-02

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 2 Jan 2021 15:03:26 +0000 (16:03 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #6530 - m-ou-se:2021, r=phansch
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.

changelog: Added support for Rust 2021.

3 years agofield_reassign_with_default: don't expand macros in suggestion
Matthias Krüger [Fri, 1 Jan 2021 15:59:59 +0000 (16:59 +0100)]
field_reassign_with_default: don't expand macros in suggestion

fixes #6522

changelog: field_reassign_with_default: don't expand macros in lint suggestion (#6522)

3 years agoInitial support for Rust 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.

3 years agofirst pass at default values for const generics
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

3 years agoAuto merge of #6526 - matthiaskrgr:version, r=Manishearth
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)

3 years agomake clippy version number correspond to rustc version number.
Matthias Krüger [Thu, 31 Dec 2020 15:07:20 +0000 (16:07 +0100)]
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

3 years agos/test_dir/test_suite_dir
Philipp Hansch [Thu, 31 Dec 2020 11:53:29 +0000 (12:53 +0100)]
s/test_dir/test_suite_dir

This should make the code slightly more understandable

3 years agoFix blessing of test output in subdirectories
Philipp Hansch [Thu, 31 Dec 2020 11:49:43 +0000 (12:49 +0100)]
Fix blessing of test output in subdirectories

The core issue was the usage of `reference_file_path.file_name()`, which
provided a non-existent path if the file to be updated was in a
subdirectory.

Instead we have to provide the whole path after 'tests/ui/' as the
'filename'. This part of the path is called `test_name` in the code now.

3 years agoRollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
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.

r? `@petrochenkov`

3 years agoAddress review comments
Philipp Hansch [Wed, 30 Dec 2020 16:29:15 +0000 (17:29 +0100)]
Address review comments

3 years agoUpdate CHANGELOG for Rust 1.50
Philipp Hansch [Wed, 30 Dec 2020 16:10:07 +0000 (17:10 +0100)]
Update CHANGELOG for Rust 1.50

3 years agoRename kw::Invalid -> kw::Empty
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.

3 years agoEnsure `Copy` exception in trait definition for `wrong_self_convention` lint
ThibsG [Wed, 30 Dec 2020 11:02:26 +0000 (12:02 +0100)]
Ensure `Copy` exception in trait definition for `wrong_self_convention` lint

3 years agoRemove unnecessary semicolon from Clippy test
Aaron Hill [Tue, 29 Dec 2020 22:15:53 +0000 (17:15 -0500)]
Remove unnecessary semicolon from Clippy test

3 years agoAdd additional lint doc to known problems section
nahuakang [Mon, 28 Dec 2020 19:44:21 +0000 (20:44 +0100)]
Add additional lint doc to known problems section

3 years agoEnable never type in empty enum ui test; run cargo dev bless
nahuakang [Mon, 28 Dec 2020 19:18:27 +0000 (20:18 +0100)]
Enable never type in empty enum ui test; run cargo dev bless

3 years agoAuto merge of #6510 - alex-700:fix-ptr-arg-lint, r=llogiq
bors [Mon, 28 Dec 2020 19:04:30 +0000 (19:04 +0000)]
Auto merge of #6510 - alex-700:fix-ptr-arg-lint, r=llogiq

don't ignore expression after first not matched method call in PtrCloneVisitor

fixes #6509

changelog: none

3 years agoCheck if never type feature is enabled by TyCtxt before suggesting empty enum lint
nahuakang [Mon, 28 Dec 2020 17:59:35 +0000 (18:59 +0100)]
Check if never type feature is enabled by TyCtxt before suggesting empty enum lint

3 years agodon't ignore expression after first not matched method call in PtrCloneVisitor
Aleksei Latyshev [Sun, 27 Dec 2020 22:09:04 +0000 (01:09 +0300)]
don't ignore expression after first not matched method call in PtrCloneVisitor

3 years agoAuto merge of #6506 - alex-700:add-path-buf-to-ptr-arg-lint, r=Manishearth
bors [Sun, 27 Dec 2020 17:59:52 +0000 (17:59 +0000)]
Auto merge of #6506 - alex-700:add-path-buf-to-ptr-arg-lint, r=Manishearth

Lint "&PathBuf instead of &Path" in PTR_ARG

fixes #6502

changelog: lint "`&PathBuf` instead of `&Path`" in `PTR_ARG`

3 years agoAuto merge of #6375 - camsteffen:reassign-default-private, r=flip1995
bors [Sun, 27 Dec 2020 16:20:47 +0000 (16:20 +0000)]
Auto merge of #6375 - camsteffen:reassign-default-private, r=flip1995

Reassign default private

changelog: fix field_reassign_with_default false positive

* Fix #6344
* Fix assumption that `field: Default::default()` is the same as `..Default::default()`
* Cleanup some redundant logic

3 years agoAuto merge of #6495 - matthiaskrgr:FN_FP_issue_templates, r=flip1995
bors [Sun, 27 Dec 2020 12:53:04 +0000 (12:53 +0000)]
Auto merge of #6495 - matthiaskrgr:FN_FP_issue_templates, r=flip1995

ISSUE_TEMPLATE: add templates for false negative and false positive tickets.

These will add the correct labels automatically so we don't have to do that ourselves :)

changelog: none

3 years agoAuto merge of #6505 - giraffate:fix_style_of_texts_in_map_err_ignore, r=phansch
bors [Fri, 25 Dec 2020 15:47:31 +0000 (15:47 +0000)]
Auto merge of #6505 - giraffate:fix_style_of_texts_in_map_err_ignore, r=phansch

Fix a style of texts in `map_err_ignore`

It's a small fix of texts.

changelog: none

3 years agolint &PathBuf instead of &Path in PTR_ARG
Aleksei Latyshev [Fri, 25 Dec 2020 11:45:04 +0000 (14:45 +0300)]
lint &PathBuf instead of &Path in PTR_ARG

- extract get_only_generic_arg_snippet to improve readability

3 years agoFix a style of texts in `map_err_ignore`
Takayuki Nakata [Thu, 24 Dec 2020 23:59:34 +0000 (08:59 +0900)]
Fix a style of texts in `map_err_ignore`

3 years agoAuto merge of #6504 - matthiaskrgr:cifix, r=matthiaskrgr
bors [Thu, 24 Dec 2020 13:37:08 +0000 (13:37 +0000)]
Auto merge of #6504 - matthiaskrgr:cifix, r=matthiaskrgr

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

3 years agoci: run cargo clippy --fix -Zunstable-options in the correct directory.
Matthias Krüger [Thu, 24 Dec 2020 12:11:34 +0000 (13:11 +0100)]
ci: run cargo clippy --fix -Zunstable-options in the correct directory.

3 years agoISSUE_TEMPLATE: add templates for false negative and false positive tickets.
Matthias Krüger [Tue, 22 Dec 2020 00:37:49 +0000 (01:37 +0100)]
ISSUE_TEMPLATE: add templates for false negative and false positive tickets.

3 years agoSpecial sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff'
flip1995 [Wed, 23 Dec 2020 09:52:53 +0000 (10:52 +0100)]
Special sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff'

3 years agoAuto merge of #6483 - xFrednet:5386-github-ticket-search, r=killercup
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>

    ![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 #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

3 years agoAuto merge of #6496 - matthiaskrgr:test_fix, r=Manishearth
bors [Tue, 22 Dec 2020 22:59:21 +0000 (22:59 +0000)]
Auto merge of #6496 - matthiaskrgr:test_fix, r=Manishearth

ci: test cargo clippy --fix -Zunstable-options

Make sure we catch cases like https://github.com/rust-lang/rust-clippy/issues/6487 in CI in the future.

---

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

3 years agoAuto merge of #6498 - rust-lang:revert-6441-use_rustflags, r=ebroto
bors [Tue, 22 Dec 2020 22:39:09 +0000 (22:39 +0000)]
Auto merge of #6498 - rust-lang:revert-6441-use_rustflags, r=ebroto

Revert "Pass Clippy args also trough RUSTFLAGS"

Reverts rust-lang/rust-clippy#6441

r? `@ebroto`

changelog: Revert "Pass Clippy args also trough RUSTFLAGS"

3 years agoFixed a value spelling mistake
xFrednet [Tue, 22 Dec 2020 20:02:59 +0000 (20:02 +0000)]
Fixed a value spelling mistake

3 years agoRevert "Pass Clippy args also trough RUSTFLAGS"
Philipp Krones [Tue, 22 Dec 2020 18:17:59 +0000 (19:17 +0100)]
Revert "Pass Clippy args also trough RUSTFLAGS"

3 years agoFix field_reassign_with_default for private fields
Cameron Steffen [Mon, 23 Nov 2020 15:23:24 +0000 (09:23 -0600)]
Fix field_reassign_with_default for private fields

3 years agoRemove redundant shadow check
Cameron Steffen [Mon, 23 Nov 2020 19:20:53 +0000 (13:20 -0600)]
Remove redundant shadow check

There is already an assertion that consecutive lines assign to a struct
field.

3 years agoFix default initialized fields in suggestion
Cameron Steffen [Mon, 23 Nov 2020 18:26:35 +0000 (12:26 -0600)]
Fix default initialized fields in suggestion

The default value for a field type does not necessarily match the
default value for that field in the struct Default.

3 years agoAuto merge of #6494 - matthiaskrgr:readme_, r=flip1995
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.

Fixes #6489

changelog: none

3 years agoAuto merge of #6476 - 1c3t3a:1c3t3a-from-over-into, r=llogiq
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.

changelog: added `from_over_into` lint

3 years agoAuto merge of #6497 - matthiaskrgr:clone_1, r=flip1995
bors [Tue, 22 Dec 2020 08:55:05 +0000 (08:55 +0000)]
Auto merge of #6497 - matthiaskrgr:clone_1, r=flip1995

remove clone in manual_async_fn lint

changelog: none

3 years agoremove clone in manual_async_fn lint
Matthias Krüger [Tue, 22 Dec 2020 02:11:35 +0000 (03:11 +0100)]
remove clone in manual_async_fn lint

3 years agoci: test cargo clippy --fix -Zunstable-options
Matthias Krüger [Tue, 22 Dec 2020 00:57:55 +0000 (01:57 +0100)]
ci: test cargo clippy --fix -Zunstable-options

3 years agoreadme: remove paragraph about executing clippy via "cargo run .."
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.

Fixes #6489

3 years agoAuto merge of #6485 - phansch:macro-check-large-enum-variant, r=llogiq
bors [Mon, 21 Dec 2020 23:49:51 +0000 (23:49 +0000)]
Auto merge of #6485 - phansch:macro-check-large-enum-variant, r=llogiq

Don't trigger large_enum_variant in external macros

Closes #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

3 years agoUpdate from_over_into.stderr
Bastian Kersting [Mon, 21 Dec 2020 16:15:05 +0000 (17:15 +0100)]
Update from_over_into.stderr

3 years agoAuto merge of #6488 - matthiaskrgr:readme_clp, r=flip1995
bors [Mon, 21 Dec 2020 15:31:07 +0000 (15:31 +0000)]
Auto merge of #6488 - matthiaskrgr:readme_clp, r=flip1995

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

3 years agoreadme: remove paragraph about installing clippy manually on ci, if it is missing...
Matthias Krüger [Mon, 21 Dec 2020 15:11:40 +0000 (16:11 +0100)]
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.

3 years agoDon't trigger large_enum_variant in external macros
Philipp Hansch [Mon, 21 Dec 2020 10:09:49 +0000 (11:09 +0100)]
Don't trigger large_enum_variant in external macros

3 years agoUpdate clippy_lints/src/from_over_into.rs
llogiq [Mon, 21 Dec 2020 08:18:30 +0000 (09:18 +0100)]
Update clippy_lints/src/from_over_into.rs

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoFixed error messages
Bastian Kersting [Sun, 20 Dec 2020 19:10:00 +0000 (20:10 +0100)]
Fixed error messages

3 years agoMerge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyup
flip1995 [Sun, 20 Dec 2020 16:19:49 +0000 (17:19 +0100)]
Merge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyup

3 years agoWebsite issue tracker link and better search performance
xFrednet [Sun, 20 Dec 2020 15:53:23 +0000 (15:53 +0000)]
Website issue tracker link and better search performance

* last minor improvements

3 years agoAuto merge of #6482 - flip1995:rustup, r=flip1995
bors [Sun, 20 Dec 2020 16:00:11 +0000 (16:00 +0000)]
Auto merge of #6482 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump nightly to 2020-12-20
flip1995 [Sun, 20 Dec 2020 15:48:26 +0000 (16:48 +0100)]
Bump nightly to 2020-12-20

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sun, 20 Dec 2020 15:25:54 +0000 (16:25 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAdded MSRV and fixed typo
Bastian Kersting [Sun, 20 Dec 2020 12:00:17 +0000 (13:00 +0100)]
Added MSRV and fixed typo

3 years agoAuto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto
bors [Sat, 19 Dec 2020 22:01:45 +0000 (22:01 +0000)]
Auto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto

Adapted the website search for better matching

* This adds the ability to search for ids with dashes and spaces in the name.
    * Example: `missing-errors-doc` and `missing errors doc` are now valid aliases for lint names
* It also improves the fuzzy search in the description. This search will now match any lint that where all searched words are inside the description.
    * Example: `doc section` finds two lints in our selection

This was suggested/discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Enable.20lint.20search.20with.20dashes/near/220469464)

### 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 loacl html page and loading data)

### Note
I found that searching only a few characters (< 3) seams slow and deleting one even more as almost every lint description contains them. This also happens in our current [lint list](https://rust-lang.github.io/rust-clippy/master/index.html). We could change the search to only be triggered if the search field contains more than 3 letters to slightly improve performance.

---

changelog: Adapted the website search for better matching

3 years agoAuto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto
bors [Sat, 19 Dec 2020 21:39:19 +0000 (21:39 +0000)]
Auto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto

Lint also in trait def for `wrong_self_convention`

Extends `wrong_self_convention` to lint also in trait definition.

By the way, I think the `wrong_pub_self_convention` [example](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/clippy_lints/src/methods/mod.rs#L197) is misleading.
On [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=32615ab3f6009e7e42cc3754be0ca17f), it fires `wrong_self_convention`, so the example (or the lint maybe?) needs to be reworked.
The difference with `wrong_self_convention` [example](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/clippy_lints/src/methods/mod.rs#L172) is mainly the `pub` keyword on the method `as_str`, but the lint doesn't use the function visibility as condition to choose which lint to fire (in fact it uses the visibility of the impl item).

fixes: #6307

changelog: Lint `wrong_self_convention` lint in trait def also

3 years agoAdapted the website search for better matching
xFrednet [Sat, 19 Dec 2020 16:12:36 +0000 (16:12 +0000)]
Adapted the website search for better matching

* Formatting

3 years agoAdded from_over_into lint
Bastian Kersting [Sat, 19 Dec 2020 14:49:42 +0000 (15:49 +0100)]
Added from_over_into lint

3 years agoAuto merge of #6473 - phansch:split-up-ui-test, r=flip1995
bors [Sat, 19 Dec 2020 13:58:22 +0000 (13:58 +0000)]
Auto merge of #6473 - phansch:split-up-ui-test, r=flip1995

UI Tests: Separate suspicious_else_formatting tests

Was briefly looking into https://github.com/rust-lang/rust-clippy/issues/3864 when I saw that the tests could benefit from being in their own file.

---
changelog: none

3 years agoUI Tests: Separate suspicious_else_formatting tests
Philipp Hansch [Sat, 19 Dec 2020 12:54:38 +0000 (13:54 +0100)]
UI Tests: Separate suspicious_else_formatting tests

3 years agoAuto merge of #6471 - phansch:fix-bless, r=flip1995
bors [Sat, 19 Dec 2020 12:28:00 +0000 (12:28 +0000)]
Auto merge of #6471 - phansch:fix-bless, r=flip1995

Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious there. The shell script did a `-s` test which
reads the file as well.

changelog: internal: Fix `cargo dev bless` when new reference files are added

3 years agoMore rebinds
Jack Huey [Thu, 17 Dec 2020 03:36:14 +0000 (22:36 -0500)]
More rebinds

3 years agoFix blessing of new reference files
Philipp Hansch [Sat, 19 Dec 2020 07:25:42 +0000 (08:25 +0100)]
Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious. The shell script did a `-s` test which reads the
file.

3 years agoAuto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs,...
bors [Sat, 19 Dec 2020 07:35:04 +0000 (07:35 +0000)]
Auto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs, r=phansch

make needless_update ignore non_exhaustive structs

changelog: make `needless_update` lint ignore `non_exhaustive` structs

fixes #6323

3 years agoremove example
Andrew Houts [Sat, 19 Dec 2020 01:15:05 +0000 (19:15 -0600)]
remove example

3 years agoAuto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995
bors [Fri, 18 Dec 2020 22:40:08 +0000 (22:40 +0000)]
Auto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995

Renamed the good first issue label in CONTRIBUTING.md

Follow up from #6468

Grep found some more references to the old `good first issue`.

[CONTRIBUTING.md rendered](https://github.com/xFrednet/rust-clippy/blob/0000-rename-good-first-issue-in-docs/CONTRIBUTING.md)

<details>
<summary>grep output</summary>

```
$ grep -Ri "good first issue" rust-clippy/
rust-clippy/.git/COMMIT_EDITMSG:Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/HEAD:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000     commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000  commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000  commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/CONTRIBUTING.md:Some issues are easier than others. The [`good first issue`] label can be used to find the easy issues.
rust-clippy/CONTRIBUTING.md:[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
rust-clippy/CONTRIBUTING.md:[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
```
</details>

---

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label in CONTRIBUTING.md
xFrednet [Fri, 18 Dec 2020 22:13:22 +0000 (22:13 +0000)]
Renamed the good first issue label in CONTRIBUTING.md

3 years agoAuto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995
bors [Fri, 18 Dec 2020 21:25:39 +0000 (21:25 +0000)]
Auto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995

Renamed the good first issue label for rustbot

The `good first issue` label got renamed to `good-first-issue`. See [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428379) to enable the assignment with rustbot.

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label for rustbot
xFrednet [Fri, 18 Dec 2020 21:18:15 +0000 (21:18 +0000)]
Renamed the good first issue label for rustbot

See https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428018