Commit graph

10779 commits

Author SHA1 Message Date
daxpedda
ea0b8324d6
Document condition. 2021-02-06 18:24:08 +01:00
daxpedda
3c8f7542f7
Fux toml_unknown_key test. 2021-02-06 18:21:03 +01:00
daxpedda
e2e33b4d35
Pick up clippy.toml in ui-cargo tests. 2021-02-06 17:57:31 +01:00
daxpedda
cd361a5e64
Add back publish = false to the old test. 2021-02-06 17:52:41 +01:00
daxpedda
8b89087409
Add test for publish = true. 2021-02-06 17:39:19 +01:00
daxpedda
f2391a5569
Change clippy configuration option. 2021-02-06 17:39:18 +01:00
daxpedda
8805931ce3
Hide clippy configuration option.
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-02-06 17:39:18 +01:00
daxpedda
f0d3fd72d7
Implement _cargo_ignore_publish. 2021-02-06 17:39:18 +01:00
daxpedda
d4bc7d2c06
Test names were flipped. 2021-02-06 17:39:17 +01:00
daxpedda
915e9b85a4
Fix cargo_common_metadata warning on publish = false. 2021-02-06 17:39:17 +01:00
Bastian Kersting
f1c15840a2 Changed lint level to restriction 2021-02-06 17:06:06 +01:00
Jonas Schievink
a5d442cdf9 Rollup merge of #81680 - camsteffen:primty, r=oli-obk
Refactor `PrimitiveTypeTable` for Clippy

I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.
2021-02-06 17:01:45 +01:00
Bastian Kersting
85c2b1e5f4 Switched to snippet_with_macro_callsite 2021-02-06 16:56:18 +01:00
Bastian Kersting
cd6748749a Revert "Fixed for loop problem, corrected all occurences that got linted"
This reverts commit 6626295fbc.
2021-02-06 16:44:57 +01:00
bors
dfb34c085f Auto merge of #6684 - matthiaskrgr:versiontest_dont_break_upstream, r=flip1995
tests: ignore check_that_clippy_has_the_same_major_version_as_rustc()inside the rustc repo

Do not check if clippy version matches rustc version when runnning tests inside the rustc repo.
This makes sure that upstream rustc maintainers do not have to deal with our test failing/mismatching versions
when the rustc version bump is happening.
cc #6683

We already do the "don't run inside the rustc-repo" workaround for the dogfood test:
a507c27660/tests/dogfood.rs (L16)

changelog: None
2021-02-06 13:38:36 +00:00
Bastian Kersting
6626295fbc Fixed for loop problem, corrected all occurences that got linted 2021-02-06 14:25:40 +01:00
Matthias Krüger
e1c284bff7 lintcheck: cleanup, fix --only for git crates, better error msgs 2021-02-06 12:24:13 +01:00
Matthias Krüger
9ab505a3c7 lintcheck: add git source as an example and update logs 2021-02-06 12:11:31 +01:00
Matthias Krüger
10fbafa562 implement the download_and_extract() step for git sources 2021-02-06 12:10:47 +01:00
Matthias Krüger
64982cc435 lintcheck: make TomlCrate also accept git-data from lintcheck_crates.toml 2021-02-06 12:10:45 +01:00
Matthias Krüger
cb3021999c lintcheck: update logs 2021-02-06 11:59:34 +01:00
Yusuke Tanaka
fbe436b1d4
Use flatten instead of filter_map 2021-02-06 18:06:58 +09:00
Yusuke Tanaka
a60c143fe0
Add new lint filter_map_identity
This commit adds a new lint named `filter_map_identity`. This lint is
the same as `flat_map_identity` except that it checks for `filter_map`.

Closes #6643
2021-02-06 18:03:14 +09:00
Matthias Krüger
93daf27a40 tests: ignore check_that_clippy_has_the_same_major_version_as_rustc() inside the rustc repo.
Do not check if clippy version matches rustc version when runnning tests inside the rustc repo.
This makes sure that upstream rustc maintainers do not have to deal with our test failing/mismatching versions
when the rustc version bump is happening.
cc #6683
2021-02-06 00:56:54 +01:00
Mark Rousskov
a9ad4923cd Bump clippy version 2021-02-05 18:32:28 -05:00
Cameron Steffen
ac5e9c8d26 Fix let_underscore_drop implements Drop logic
This fixes false positives and false negatives.
2021-02-05 14:54:06 -06:00
Bastian Kersting
55bfaa12d3 Fixed macro edge case for semicolon_if_nothing_returned lint 2021-02-05 20:48:46 +01:00
Bastian Kersting
f907986580 Added documentation 2021-02-05 20:19:22 +01:00
Bastian Kersting
eb9c6698ee First version of the lint 2021-02-05 20:19:22 +01:00
bors
a507c27660 Auto merge of #6679 - flip1995:ra_setup_abs_path, r=Manishearth
Use absolute path to Rust repo in ra_setup

This will convert the path to the Rust repo to an absolute path. This is
important for the clippy_lints/Cargo.toml file. Otherwise if a relative
path is passed, rst-analyzer won't find the Rust repo, because it starts
the relative path search from the clippy_lints dir, not the
rust-clippy dir where the ra_setup command was run from.

changelog: none
2021-02-05 17:48:46 +00:00
bors
89f266a082 Auto merge of #6678 - TaKO8Ki:fix-typo, r=flip1995
Fix typo

This patch fixes a typo.

changelog: none
2021-02-05 17:16:50 +00:00
Cameron Steffen
56f7fbb4ae Cleanup path to local checks 2021-02-05 10:24:32 -06:00
flip1995
79dbf10736
Use absolute path to Rust repo in ra_setup
This will convert the path to the Rust repo to an absolute path. This is
important for the clippy_lints/Cargo.toml file. Otherwise if a relative
path is passed, rst-analyzer won't find the Rust repo, because it starts
the relative path search from the clippy_lints dir, not the
rust-clippy dir where the ra_setup command was run from.
2021-02-05 17:23:04 +01:00
Takayuki Maeda
67d48e1c59 fix typo 2021-02-06 00:10:52 +09:00
Philip Hayes
7b7e3ca511 Support free functions in disallowed-methods lint
In other words, support:

`disallowed_methods = ["alloc::vec::Vec::new"]` (a free function) in
addition to
`disallowed_methods = ["alloc::vec::Vec::leak"]` (a method).

Improve the documentation to clarify that users must specify the full
qualified path for each disallowed function, which can be confusing for
reexports. Include an example `clippy.toml`.

Simplify the actual lint pass so we can reuse `utils::fn_def_id`.
2021-02-04 11:28:55 -08:00
ThibsG
233fe11ce9 Set turbofish for every sugg and add more test cases 2021-02-04 19:08:08 +01:00
Yoshitomo Nakanishi
8b8b0a94b0 Fix enclosing_body_owner_opt and rename it to enclosing_body_opt 2021-02-04 22:57:03 +09:00
bors
357c6a7e27 Auto merge of #6646 - nahuakang:for_loops_over_options_or_results, r=flip1995
New Lint: Manual Flatten

This is a draft PR for [Issue 6564](https://github.com/rust-lang/rust-clippy/issues/6564).

r? `@camsteffen`

- \[x] 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: Add new lint [`manual_flatten`] to check for loops over a single `if let` expression with `Result` or `Option`.
2021-02-04 10:03:45 +00:00
nahuakang
2f8a8d3468 Improve lint message; add note for future autofixable updates 2021-02-04 10:51:40 +01:00
Yoshitomo Nakanishi
e32e4dedf1 New lint: default_numeric_fallback 2021-02-04 17:26:43 +09:00
Mara Bos
9f7f8b71a6 Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call. 2021-02-03 23:15:51 +01:00
Mara Bos
0767a0f9c7 Fix/allow non_fmt_panic in clippy tests. 2021-02-03 23:15:51 +01:00
nahuakang
78ef0f2f6c Add additional test cases and improve span lint 2021-02-03 21:54:38 +01:00
bors
876ffa4674 Auto merge of #6669 - magurotuna:fix-test-name, r=flip1995
Fix file names of flat_map_identity test

This patch fixes the file names of the `flat_map_identity` test.
Previously, their names were started with `unnecessary_flat_map` even though the lint rule name is `flat_map_identity`. This inconsistency happened probably because the rule name was changed during the discussion in the PR where this rule was introduced.

ref: https://github.com/rust-lang/rust-clippy/pull/4231

changelog: none
2021-02-03 15:39:37 +00:00
Yusuke Tanaka
6396b8fb7f
Fix file names of flat_map_identity test
This commit fixes the file names of the `flat_map_identity` test.
Previously, their names were started with `unnecessary_flat_map` even
though the lint rule name is `flat_map_identity`. This inconsistency
happened probably because the rule name was changed during the
discussion in the PR where this rule was introduced.

ref: https://github.com/rust-lang/rust-clippy/pull/4231
2021-02-04 00:06:26 +09:00
Cameron Steffen
f2e82af3f2 Use PrimTy in builtin type shadow lint 2021-02-03 08:32:23 -06:00
nahuakang
0f5e71f8f2 Add additional check on if arg type has iter method 2021-02-03 09:39:35 +01:00
Manish Goregaokar
c8cb90abbd Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy 2021-02-02 20:43:30 -08:00
bors
3e4179766b Auto merge of #6667 - Manishearth:rustup, r=Manishearth
Rustup

Pulling in AST changes

changelog: none
2021-02-03 04:09:03 +00:00
Manish Goregaokar
741259bece Merge branch 'sync-from-rust3' into rustup 2021-02-02 19:57:31 -08:00