]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMake a reference a link in doc
Takayuki Nakata [Wed, 13 Jan 2021 00:21:26 +0000 (09:21 +0900)]
Make a reference a link in doc

3 years agoAuto merge of #6462 - flip1995:roadmap, r=flip1995,llogiq,killercup,Manishearth,oli...
bors [Tue, 12 Jan 2021 16:33:47 +0000 (16:33 +0000)]
Auto merge of #6462 - flip1995:roadmap, r=flip1995,llogiq,killercup,Manishearth,oli-obk,matthiaskrgr,phansch,mikerite,mcarton,yaahc,ebroto

Roadmap for 2021

[Rendered](https://github.com/flip1995/rust-clippy/blob/roadmap/doc/roadmap-2021.md)

This is the first time Clippy gets its own roadmap. The reason for this roadmap is, that with the Rust language growing, also Clippy is growing. With this keeping track of and implementing bigger projects gets quite hard. This roadmap should help in exactly this regard.

After having the approval of this roadmap by the Clippy team, we want to know from the community:

- What do you think in general about this roadmap?
- Are there any pain points in Clippy, that should be included here?
- What of the points listed here has the highest priority for you?

We're looking forward to getting your feedback!

changelog: Add roadmap for Clippy 2021

r? `@rust-lang/clippy`

3 years agoAuto merge of #6557 - rail-rain:extending_cast_ptr_alignment, r=phansch
bors [Mon, 11 Jan 2021 22:03:46 +0000 (22:03 +0000)]
Auto merge of #6557 - rail-rain:extending_cast_ptr_alignment, r=phansch

Catch `pointer::cast` too in `cast_ptr_alignment`

Fixes #4708

Although there were some discussion in the issue, this PR implements the original feature. I think `cast_ptr_alignment` should exist as it is, separated from `ptr_as_ptr`.

---

changelog: Extend `cast_ptr_alignment` lint for the `pointer::cast` method

3 years agoSimplify `cast_ptr_alignment` `pointer::casr` case
rail [Mon, 11 Jan 2021 21:06:41 +0000 (10:06 +1300)]
Simplify `cast_ptr_alignment` `pointer::casr` case

3 years agoAuto merge of #6575 - flip1995:stop_linting_deps, r=Manishearth
bors [Mon, 11 Jan 2021 16:49:32 +0000 (16:49 +0000)]
Auto merge of #6575 - flip1995:stop_linting_deps, r=Manishearth

Change env var used for testing Clippy

This changes the variable used for testing Clippy in the internal test
suite:

```
CLIPPY_TESTS -> __CLIPPY_INTERNAL_TESTS
```

`CLIPPY_TESTS` is understandably used in environments of Clippy users,
so we shouldn't use it in our test suite.

changelog: Fix oversight which caused Clippy to lint deps in some environments.

Once again fixes https://github.com/rust-lang/rust-clippy/issues/3874

3 years agoAuto merge of #6565 - giraffate:small_fixes_of_doc_in_needless_question_mark, r=phansch
bors [Sat, 9 Jan 2021 15:28:10 +0000 (15:28 +0000)]
Auto merge of #6565 - giraffate:small_fixes_of_doc_in_needless_question_mark, r=phansch

Small fixes of doc in `needless_question_mark`

changelog: none

3 years agoAuto merge of #6571 - ThibsG:BoxedLocalTrait, r=phansch
bors [Sat, 9 Jan 2021 13:42:28 +0000 (13:42 +0000)]
Auto merge of #6571 - ThibsG:BoxedLocalTrait, r=phansch

Fix FP for `boxed_local` lint in default trait fn impl

Fix FP on default trait function implementation on `boxed_local` lint.

Maybe I checked too much when looking if `self` is carrying `Self` in its bound type.
I can't find a good test case for this, so it could be too much conservative.
Let me know if you think only detecting `self` parameter is enough.

Fixes: #4804
changelog: none

3 years agoFix FP for `boxed_local` lint in default trait fn impl
ThibsG [Sat, 9 Jan 2021 11:26:24 +0000 (12:26 +0100)]
Fix FP for `boxed_local` lint in default trait fn impl

3 years agoAuto merge of #6569 - camsteffen:symbol-comparison, r=Manishearth
bors [Fri, 8 Jan 2021 23:25:57 +0000 (23:25 +0000)]
Auto merge of #6569 - camsteffen:symbol-comparison, r=Manishearth

Internal lint symbol comparisons

changelog: none

* Added awareness of `rustc_span::symbol::kw::*` symbols.
* Compare with const symbols: `symbol.as_str() == "self"` => `symbol == kw::SelfLower`
* Don't compare symbols by string: `a.as_str() == b.as_str()` => `a == b`
* Lint comparing with `to_ident_string` or `to_string` instead of `Symbol::as_str`.

3 years agoFix symbol string comparison dogfood
Cameron Steffen [Tue, 29 Dec 2020 22:04:31 +0000 (16:04 -0600)]
Fix symbol string comparison dogfood

3 years agoAdd unnecessary symbol string lint
Cameron Steffen [Wed, 30 Dec 2020 21:52:15 +0000 (15:52 -0600)]
Add unnecessary symbol string lint

3 years agoFix unnecessary keyword intern dogfood
Cameron Steffen [Tue, 29 Dec 2020 21:43:18 +0000 (15:43 -0600)]
Fix unnecessary keyword intern dogfood

3 years agoAdd keywords to interning defined symbol lint
Cameron Steffen [Tue, 29 Dec 2020 21:40:55 +0000 (15:40 -0600)]
Add keywords to interning defined symbol lint

3 years agoUse DefId in interning defined symbol lint
Cameron Steffen [Wed, 30 Dec 2020 21:38:21 +0000 (15:38 -0600)]
Use DefId in interning defined symbol lint

3 years agoAuto merge of #6566 - giraffate:reduce_the_span_in_from_over_into, r=Manishearth
bors [Fri, 8 Jan 2021 01:49:26 +0000 (01:49 +0000)]
Auto merge of #6566 - giraffate:reduce_the_span_in_from_over_into, r=Manishearth

Reduce the span in `from_over_into` to impl header

A follow up of https://github.com/rust-lang/rust-clippy/pull/6476#discussion_r546271382
> That item might be quite large. We may want to reduce the span to the `impl` header.

changelog: none

3 years agoMove `is_hir_ty_cfg_dependant` to `util`,
rail [Fri, 8 Jan 2021 01:15:12 +0000 (14:15 +1300)]
Move `is_hir_ty_cfg_dependant` to `util`,

add stuff on pointer::cast` to the document for `cast_ptr_alignment`
and fix line numbers in the test.

3 years agoReduce the span in `from_over_into` to impl header
Takayuki Nakata [Thu, 7 Jan 2021 23:37:57 +0000 (08:37 +0900)]
Reduce the span in `from_over_into` to impl header

3 years agoSmall fixes of doc in `needless_question_mark`
Takayuki Nakata [Thu, 7 Jan 2021 23:45:15 +0000 (08:45 +0900)]
Small fixes of doc in `needless_question_mark`

3 years agoAuto merge of #6558 - stanislav-tkach:patch-2, r=flip1995
bors [Thu, 7 Jan 2021 13:38:32 +0000 (13:38 +0000)]
Auto merge of #6558 - stanislav-tkach:patch-2, r=flip1995

Fix typo: `irrevelent` -> `irrelevant`

changelog: none

3 years agoFix typo: `irrevelent` -> `irrelevant`
Stanislav Tkach [Thu, 7 Jan 2021 11:59:55 +0000 (13:59 +0200)]
Fix typo: `irrevelent` -> `irrelevant`

3 years agoChange env var used for testing Clippy
flip1995 [Thu, 7 Jan 2021 11:38:10 +0000 (12:38 +0100)]
Change env var used for testing Clippy

This changes the variable used for testing Clippy in the internal test
suite:

```
CLIPPY_TESTS -> __CLIPPY_INTERNAL_TESTS
```

`CLIPPY_TESTS` is understandably used in environments of Clippy users,
so we shouldn't use it in our test suite.

3 years agoCatch `pointer::cast` too in `cast_ptr_alignment`
rail [Thu, 7 Jan 2021 03:41:15 +0000 (16:41 +1300)]
Catch `pointer::cast` too in `cast_ptr_alignment`

3 years agoAuto merge of #6554 - sozysozbot:master, r=flip1995
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`

changelog: none

3 years agoFix typo: `which which can be` -> `which can be`
jekto_vatimeliju [Wed, 6 Jan 2021 11:02:50 +0000 (20:02 +0900)]
Fix typo: `which which can be` -> `which can be`

3 years agoAuto merge of #6553 - phansch:field-reassign-with-default-macros, r=flip1995
bors [Wed, 6 Jan 2021 08:22:47 +0000 (08:22 +0000)]
Auto merge of #6553 - phansch:field-reassign-with-default-macros, r=flip1995

Fix derive and macro related false positives in `field_reassign_with_default`

Closes #6545

changelog: Fix derive and macro related false positives in [`field_reassign_with_default`]

3 years agoFix macro issues with field_reassign_with_default
Philipp Hansch [Tue, 5 Jan 2021 19:11:37 +0000 (20:11 +0100)]
Fix macro issues with field_reassign_with_default

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 #6551 - phansch:tiny-symbol-cleanup, r=flip1995
bors [Tue, 5 Jan 2021 15:22:57 +0000 (15:22 +0000)]
Auto merge of #6551 - phansch:tiny-symbol-cleanup, r=flip1995

Tiny Symbol cleanup

* Renames `sym.rs` to `sym_helper.rs` so that the `sym as rustc_sym` is no longer needed.
* Removes one needless `symbol` from a path

changelog: none

3 years agoTiny Symbol cleanup
Philipp Hansch [Tue, 5 Jan 2021 15:03:39 +0000 (16:03 +0100)]
Tiny Symbol cleanup

* Renames `sym.rs` to `sym_helper.rs` so that the `sym as rustc_sym` is no longer needed.
* Removes one needless `symbol` from a path

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 agoAdd prioritization chapter and remove unresolved questions
flip1995 [Mon, 4 Jan 2021 10:37:48 +0000 (11:37 +0100)]
Add prioritization chapter and remove unresolved questions

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