Commit Graph

10544 Commits

Author SHA1 Message Date
bors
ae9ae9713c 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
2021-01-04 14:17:24 +00:00
Benjamin Sparks
ba87acb440
Implemented needless question mark lint 2021-01-04 14:51:48 +01:00
bors
dd1929e1f2 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
2021-01-04 12:45:51 +00:00
Matthias Krüger
6dcec6ae86 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
2021-01-04 13:34:14 +01:00
flip1995
d141cdc947
Add prioritization chapter and remove unresolved questions 2021-01-04 11:39:14 +01:00
bors
895191628d 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
2021-01-04 09:23:01 +00:00
Matthias Krüger
39f39d5405 match_like_matches_macro: strip refs in suggestion
fixes #6503

changelog: match_like_matches_macro: strip refs in suggestion (#6503)
2021-01-03 20:28:46 +01:00
Jason Newcomb
7b5f54954a
Fix docs: use type inference 2021-01-03 14:04:05 -05:00
bors
a02806e00d 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
2021-01-02 23:51:49 +00:00
bors
592f7eb7eb 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)
2021-01-02 23:38:23 +00:00
Jason Newcomb
d37ee6ffa0
Fix lint errors 2021-01-02 14:31:21 -05:00
Jason Newcomb
9427e0356b
Fix clone_on_copy test 2021-01-02 14:15:11 -05:00
flip1995
053afe4907 Use bootstrap rustc for versioncheck in Clippy 2021-01-02 18:12:28 +01:00
bors
78f6009878 Auto merge of #6520 - phansch:update-changelog, r=flip1995
Update CHANGELOG for Rust 1.50

changelog: none

r? `@flip1995`
2021-01-02 16:13:24 +00:00
Jason Newcomb
1853f8b228
Add lint 2021-01-02 11:08:56 -05:00
flip1995
ba4bf4f9c5 Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup 2021-01-02 16:29:43 +01:00
bors
1fcc74cc9e Auto merge of #6536 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-01-02 15:28:08 +00:00
flip1995
e4fbc5f423
Bump Clippy version to 0.1.51 2021-01-02 16:26:10 +01:00
flip1995
106ca96653
Use rustc --version in versioncheck 2021-01-02 16:20:43 +01:00
flip1995
db268f8ef8
Bump nightly version to 2021-01-02 2021-01-02 16:05:54 +01:00
flip1995
d93692efa2
Merge remote-tracking branch 'upstream/master' into rustup 2021-01-02 16:03:26 +01:00
bors
b1965283fd 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.
2021-01-02 13:12:15 +00:00
Matthias Krüger
5d48b91b40 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)
2021-01-01 17:01:09 +01:00
Mara Bos
e5a1f22f48 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.
2021-01-01 16:21:31 +01:00
Julian Knodt
48dec842f2 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
2021-01-01 10:55:10 +01:00
bors
60919e416d 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)
2021-01-01 09:01:32 +00:00
Matthias Krüger
59397d6abb 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
2020-12-31 16:29:26 +01:00
Philipp Hansch
69090550cb
s/test_dir/test_suite_dir
This should make the code slightly more understandable
2020-12-31 12:53:29 +01:00
Philipp Hansch
6b37932268
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.
2020-12-31 12:49:43 +01:00
Mara Bos
7f44f1d038 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`
2020-12-30 20:56:58 +00:00
Philipp Hansch
b81111bc35
Address review comments 2020-12-30 17:29:15 +01:00
Philipp Hansch
0afe2dbad8
Update CHANGELOG for Rust 1.50 2020-12-30 17:10:07 +01:00
Joshua Nelson
5479bbaf72 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.
2020-12-30 09:50:02 -05:00
ThibsG
af480a67be Ensure Copy exception in trait definition for wrong_self_convention lint 2020-12-30 12:02:26 +01:00
Aaron Hill
6fd18f95ca Remove unnecessary semicolon from Clippy test 2020-12-29 17:16:04 -05:00
nahuakang
275988cb73 Add additional lint doc to known problems section 2020-12-28 20:45:56 +01:00
nahuakang
83a458acf1 Enable never type in empty enum ui test; run cargo dev bless 2020-12-28 20:18:27 +01:00
bors
0d8a27a6f6 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
2020-12-28 19:04:30 +00:00
nahuakang
469281c0dd Check if never type feature is enabled by TyCtxt before suggesting empty enum lint 2020-12-28 18:59:35 +01:00
Aleksei Latyshev
203715aa4e
don't ignore expression after first not matched method call in PtrCloneVisitor 2020-12-28 01:09:04 +03:00
bors
61a3ee7935 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`
2020-12-27 17:59:52 +00:00
bors
3661848997 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
2020-12-27 16:20:47 +00:00
bors
015496579d 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
2020-12-27 12:53:04 +00:00
bors
b1e0d15d58 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
2020-12-25 15:47:31 +00:00
Aleksei Latyshev
dfaea9c967
lint &PathBuf instead of &Path in PTR_ARG
- extract get_only_generic_arg_snippet to improve readability
2020-12-25 15:06:34 +03:00
Takayuki Nakata
e1743ef525 Fix a style of texts in map_err_ignore 2020-12-25 08:59:34 +09:00
bors
02399f4b25 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
2020-12-24 13:37:08 +00:00
Matthias Krüger
2218dd6554 ci: run cargo clippy --fix -Zunstable-options in the correct directory. 2020-12-24 13:57:39 +01:00
Matthias Krüger
3687de2159 ISSUE_TEMPLATE: add templates for false negative and false positive tickets. 2020-12-23 12:28:16 +01:00
flip1995
88491e2a51 Special sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff' 2020-12-23 10:57:35 +01:00