Commit Graph

10852 Commits

Author SHA1 Message Date
Cameron Steffen
9ad6e263c9 Fix match_same_arms with SpanlessEq changes 2021-02-17 10:47:26 -06:00
Cameron Steffen
742922a41a Make expr_fallback FnMut 2021-02-17 10:47:26 -06:00
Cameron Steffen
4ac14f9e63 Teach SpanlessEq binding IDs 2021-02-17 10:47:26 -06:00
bors
ddeea97714 Auto merge of #6750 - flip1995:lintcheck_options, r=matthiaskrgr
Lintcheck and an options for command line options

Make it possible to add command line options to the clippy invocation of the lintcheck-tool

changelog: none

r? `@matthiaskrgr`

I found that this will be really helpful if we use a separate repository and want to maintain a all-lints-passing list of crates. See my early experimentation here: https://github.com/flip1995/clippy-lintcheck

```
git submodule update --init
cargo run -- --mode=all
```

Will run the lintcheck tool on all the specified crates in `config/` in that repository.
2021-02-17 12:53:31 +00:00
Takayuki Maeda
2d60a6113d replace if-let and while-let with if let and while let 2021-02-17 19:26:38 +09:00
flip1995
79d7f4ccb3
lintcheck: Add a note that -Wclippy::all is enabled by default 2021-02-17 08:35:57 +01:00
flip1995
e3f584665a
Reformat clippy_dev README 2021-02-16 18:09:34 +01:00
bors
877be189ad Auto merge of #6749 - camsteffen:test-all, r=Manishearth
Test workspace at once

changelog: none

Follow-up to #6733
2021-02-16 17:03:03 +00:00
Cameron Steffen
e355652fec Test workspace at once 2021-02-16 10:50:43 -06:00
Cameron Steffen
9bcb257985 Add workspace to manifest 2021-02-16 10:14:40 -06:00
flip1995
dd5c9b7dda
lintcheck: Slight improvements to the error reporting 2021-02-16 16:58:00 +01:00
flip1995
2a28ea0bea
Add command line options option to lintcheck crates config 2021-02-16 16:57:30 +01:00
bors
e2753f9a7b Auto merge of #6662 - Y-Nak:default-numeric-fallback, r=flip1995
New lint: default_numeric_fallback

fixes #6064
r? `@flip1995`

As we discussed in [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.236064/near/224647188) and [here](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20clippy.236064/near/224746333),   I start implementing this lint from the strictest version.
In this PR, I'll allow the below two cases to pass the lint to reduce FPs.

1. Appearances of unsuffixed numeric literals in `Local` if `Local` has a type annotation, for example:
```rust
// Good.
let x: i32 = 1;

// Also good.
let x: (i32, i32) = if cond {
   (1, 2)
} else {
   (2, 3)
};
```

2. Appearances of unsuffixed numeric literals in args of `Call` or `MethodCall`  if corresponding arguments of their signature have concrete types, for example:
```rust
fn foo_mono(x: i32) -> i32 {
    x
}

fn foo_poly<T>(t: T) -> t {
    t
}

// Good.
let x = foo_mono(13);

// Still bad.
let x: i32 = foo_poly(13);
```

changelog: Added restriction lint: `default_numeric_fallback`
2021-02-16 09:58:49 +00:00
Yoshitomo Nakanishi
9b0c1ebc18 Change to span_lint_and_sugg from span_lint_and_help 2021-02-16 18:07:09 +09:00
bors
f28c54cd08 Auto merge of #6744 - matthiaskrgr:lintcheck, r=flip1995
more lintcheck updates

* do some refactoring and renaming here and there
* add comments to functions
* fix bug where git repos would not get checked out to the proper commits (cmd was not actually run in repo directory 😅 )
* print warnings if we can't clone or check out a git repo
* filter out noise from cargo-metadata errors and lint messages that contained absolute file paths (these would change with every pinned-nightly bump, polluting the logs)

changelog: more lintcheck refactoring and fixes for git crates
2021-02-16 08:20:17 +00:00
Yoshitomo Nakanishi
1f8ee3cc19 Handle struct ctor case 2021-02-16 11:20:51 +09:00
Matthias Krüger
a95c250372 lintcheck: update logs 2021-02-15 23:38:51 +01:00
Matthias Krüger
028692b46a lintcheck: filter out messages that come from cargo-metadata errors or contain absolute paths to rustc source files
The latter is especially annoying because the paths would change every time we bumped the pinned nightly version.
2021-02-15 23:38:50 +01:00
Matthias Krüger
8f1cceb6ff lintcheck: print warnings if we can't check out or clone a git repo 2021-02-15 22:48:33 +01:00
Matthias Krüger
f8dbcae9f4 lintcheck: fix bug in downloade_and_extract() for git sources: we need to execute "git checkout xy" inside the repo dir! 2021-02-15 22:48:32 +01:00
Matthias Krüger
214d821268 lintcheck: put some code into a gather_stats() function 2021-02-15 22:13:17 +01:00
Matthias Krüger
4856e5f8fc lintcheck: rename a few symbols, add documentation to functions 2021-02-15 22:13:17 +01:00
Matthias Krüger
1b74439871 lintcheck: rename struct field 2021-02-15 22:13:17 +01:00
bors
87c682a06e Auto merge of #6743 - rust-lang:update-compiletest, r=Manishearth
Upgrade compiletest-rs to 0.6 and tester to 0.9

These updates allow us to specify multiple testnames for `TESTNAME` by
providing a comma separated list of testnames.

The new version of compiletest-rs also includes `bless` support, but is
not enabled with this PR.

cc #5394

changelog: none
2021-02-15 19:18:41 +00:00
Philipp Hansch
7226291025
Upgrade compiletest-rs to 0.6 and tester to 0.9
These updates allow us to specify multiple testnames for `TESTNAME`.

The new version of compiletest-rs also includes `bless` support, but is
not enabled with this PR.
2021-02-15 20:13:44 +01:00
Camille GILLOT
dbe7609414 Only store a LocalDefId in hir::ImplItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT
fc9bc33bba Only store a LocalDefId in hir::TraitItem. 2021-02-15 19:32:28 +01:00
Camille GILLOT
2dc65397ee Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00
Camille GILLOT
5b68fc16ed Use ItemId as a strongly typed index. 2021-02-15 19:24:58 +01:00
Yoshitomo Nakanishi
fb91c76586 Add more tests for default_numeric_fallback 2021-02-15 23:33:27 +09:00
Yoshitomo Nakanishi
0198ac7bdd Add fn_sig_opt to get fn signature from HirId 2021-02-15 23:29:18 +09:00
Yoshitomo Nakanishi
93796b2346 Add some restrictions to default_numeric_fallback to avoid FNs 2021-02-15 14:43:37 +09:00
bors
2f19f5f0d7 Auto merge of #6741 - ThibsG:BlockInIfConditions1141, r=flip1995
Do not lint when the closure is called using an iterator

Fix FP when the closure is used in an iterator for `blocks_in_if_conditions` lint

FIxes: #1141

changelog: none
2021-02-14 15:55:12 +00:00
ThibsG
12025506d6 Do not lint when the closure is called using an iterator 2021-02-14 16:21:12 +01:00
bors
9c3b43efdd Auto merge of #6701 - camsteffen:collapsible-if, r=flip1995
Fix collapsible_if with attributes

changelog: Fix collapsible_if FP with attributes

Fixes #6593
2021-02-14 14:43:35 +00:00
bors
eb80ac4e72 Auto merge of #6697 - camsteffen:vec-init-push-fp, r=flip1995
Fix vec_init_then_push false positives

changelog: Fix vec_init_then_push false positives

Fixes #6615
2021-02-14 14:27:13 +00:00
bors
ce0a47ab8c Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
directly expose copy and copy_nonoverlapping intrinsics

This effectively un-does https://github.com/rust-lang/rust/pull/57997. That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163.

Cc `@bjorn3` `@therealprof`
2021-02-13 20:30:07 +00:00
bors
5f611ceef7 Auto merge of #6736 - Y-Nak:reproducer-for-use_self-ice, r=flip1995
Add a minimal reproducer for the ICE in #6179

This PR is an auxiliary PR for #6179, just add a minimal reproducer for the ICE discussed in #6179.
See #6179 for more details.

changelog: none
2021-02-13 18:59:59 +00:00
Mara Bos
dd91987533 Fix clippy's path to the copy intrinsics. 2021-02-13 18:58:54 +01:00
Yoshitomo Nakanishi
87109bb4f5 Add minimal reproducer for ICE in #6179 2021-02-14 01:20:30 +09:00
bors
51aefbdd91 Auto merge of #6735 - matthiaskrgr:lintcheck, r=flip1995
lintcheck: accept env var to set crates.toml file

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: lintcheck: accept  LINTCHECK_TOML env var to set list of crates to be checked.
2021-02-13 16:03:07 +00:00
Philipp Krones
0256103c10
Use title case in clippy_dev README 2021-02-13 16:55:01 +01:00
bors
0ce5eccd66 Auto merge of #6738 - xFrednet:0000-update-labels-in-template-files, r=flip1995
Update labels in template files

It seems like we forgot to update the GitHub templates when we decided to update the label names. This PR just adjusts the templates to use the new label names :)

Context: [Zulip discussion about renaming the labels](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Label.20cleanup/near/224083870)

---

changelog: none
2021-02-13 15:51:14 +00:00
xFrednet
8c5d301e1b Updated labels in template files
For context: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Label.20cleanup/near/224083870
2021-02-13 16:45:34 +01:00
Matthias Krüger
fedfbb9011 lintcheck: explain sources.toml configuration 2021-02-13 01:28:00 +01:00
Matthias Krüger
5bbb1bc20a lintcheck: env var LINTCHECK_TOML can be used to override toml file location (has precedence over --crates-toml flag) 2021-02-13 00:39:19 +01:00
boolean_coercion
d36fe85569 Made parens addition smarter and added tests with bless 2021-02-13 00:33:08 +02:00
bors
047f3e16bf Auto merge of #6700 - daxpedda:panics-doc-unreachable, r=llogiq
Fix missing_panics_doc warning on `unreachable!`.

Fixes #6699.

Are there any other test-cases I should cover?

changelog: [`missing_panics_doc`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc): No longer lints on [`unreachable!`](https://doc.rust-lang.org/std/macro.unreachable.html)
2021-02-12 20:48:05 +00:00
boolean_coercion
642efabfbb Fixed typos and updated to matches! where applicable 2021-02-12 11:54:22 +02:00
boolean_coercion
9194c11d69 Fixed doctests that shouldn't have been compiled 2021-02-12 11:54:22 +02:00