Commit Graph

5869 Commits

Author SHA1 Message Date
bors
95e537b039 Auto merge of #3987 - phansch:rustfix_option_map_or_none, r=flip1995
Add run-rustfix for option_map_or_none lint

* Extracts `option_map_or_none` tests into separate file
 * Adds `// run-rustfix` to `tests/ui/option_map_or_none.rs`

cc #3630
2019-04-18 09:43:42 +00:00
bors
b834dbb2d5 Auto merge of #3984 - phansch:bytecount_sugg, r=flip1995
Change naive_bytecount applicability to MaybeIncorrect

We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.

Example:

```
error: You appear to be counting bytes the naive way
  --> $DIR/bytecount.rs:5:13
   |
LL |     let _ = x.iter().filter(|&&a| a == 0).count(); // naive byte count
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider using the bytecount crate: `bytecount::count(x, 0)`
```

Just replacing it with the suggestion is not enough.

cc #3630
2019-04-18 07:49:09 +00:00
bors
58e12130e4 Auto merge of #3968 - kraai:lint-pass-macros, r=flip1995
Lint pass macros
2019-04-18 07:24:35 +00:00
Philipp Hansch
0f69aac3d9
Add run-rustfix for option_map_or_none lint 2019-04-18 08:12:59 +02:00
Philipp Hansch
01ea9bd9d8
Change naive_bytecount applicability MaybeIncorrect
We can't use `MachineApplicable` here as applying the fix will cause
another error because `bytecount` would first have to be added to the
Cargo.toml.
2019-04-17 20:46:42 +02:00
Matthew Kraai
ef29db773e Add tests for declare_lint_pass and impl_lint_pass 2019-04-17 09:35:23 -07:00
Matthew Kraai
753c39672e Use lint pass macros
Fixes #3917.
2019-04-17 09:35:22 -07:00
Matthew Kraai
24bb63383a Document declare_lint_pass! 2019-04-17 06:51:21 -07:00
flip1995
ce87051779 Fix lint_without_lint_pass internal lint 2019-04-17 06:51:21 -07:00
bors
3e760cc93a Auto merge of #3926 - flip1995:def_path_uplift, r=phansch
Use {get,match}_def_path from rustc

This is a follow up of the uplift of `{get,match}_def_path` to rustc.

~~This is blocked on rust-lang/rust#59779~~
2019-04-17 11:09:25 +00:00
flip1995
840eac2c05
Use {get,match}_def_path from LateContext 2019-04-17 12:53:29 +02:00
flip1995
2f100e04af
Remove uplifted functions {get,match}_def_path from Clippy 2019-04-17 12:51:57 +02:00
bors
27d62cf603 Auto merge of #3966 - flip1995:internal_lints, r=oli-obk
Enable rustc internal lints

Closes #3965

I'm not 100% sure if enabling the `-Zunstable-options` flag in the `.cargo/config` file is the right place.
2019-04-17 04:46:19 +00:00
bors
ea25f044ec Auto merge of #3977 - phansch:add_rustfix_bool_comparison, r=flip1995
Add run-rustfix for bool_comparison lint

cc #3630
2019-04-17 02:35:02 +00:00
bors
1936368da1 Auto merge of #3976 - phansch:deref_addrof_rustfix, r=flip1995
Add run-rustfix for deref_addrof lint

* renames `tests/ui/reference.{rs,stderr}` to
  `tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
  triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`

cc #3630
2019-04-17 01:50:58 +00:00
bors
1132caabff Auto merge of #3975 - phansch:has_placeholders, r=flip1995
Change while_let_loop applicability to HasPlaceholders

The suggestion has been changed at some point to use `..` in the suggested code.
Due to that we can't make the lint MachineApplicable anymore.

cc #3630
2019-04-17 01:14:27 +00:00
bors
e4eee4baba Auto merge of #3972 - rust-lang:oli-obk-patch-1, r=flip1995,Manishearth
Create PULL_REQUEST_TEMPLATE

changelog: none

addresses https://github.com/rust-lang/rust-clippy/issues/3955#issuecomment-483567400
2019-04-16 23:52:59 +00:00
Philipp Hansch
90ddf0da6c
Add run-rustfix for bool_comparison lint 2019-04-16 20:42:54 +02:00
Philipp Hansch
d1e84c615c
Add run-rustfix for deref_addrof lint
* renames `tests/ui/reference.{rs,stderr}` to
  `tests/ui/deref_addrof.{rs,stderr}
* Moves small part of the testfile to a separate file as the lint
  triggered again on the fixed code (as intended)
* Adds `// run-rustfix` to `tests/ui/deref_addrof.rs`
2019-04-16 20:32:54 +02:00
Philipp Hansch
e974d84d03
while_let_loop uses placeholders in suggestions
Due to that we can't make the lint MachineApplicable anymore.
2019-04-16 20:05:16 +02:00
flip1995
118f7d54c4
Remove rust-toolchain file from clippy_dev 2019-04-16 17:17:07 +02:00
Oliver Scherer
3b0185be45
Update adding_lints.md 2019-04-16 15:16:08 +02:00
Oliver Scherer
d383a12deb
Update PULL_REQUEST_TEMPLATE 2019-04-16 15:15:19 +02:00
Oliver Scherer
f33cbc152d
Add new lint checklist 2019-04-16 13:30:46 +02:00
Oliver Scherer
275dbec86d
Create PULL_REQUEST_TEMPLATE 2019-04-16 11:04:42 +02:00
bors
3e8d992bd8 Auto merge of #3970 - rust-lang:map_copied, r=flip1995
Suggest .copied() instead of .cloned() in map_clone where applicable

partial fix for https://github.com/rust-lang/rust-clippy/issues/3958

changelog: Improve suggestion in `map_clone` to suggest `.copied()` where applicable
2019-04-16 07:29:35 +00:00
Manish Goregaokar
e9cde416ba Only suggest .copied() for Option right now 2019-04-15 15:44:09 -07:00
Manish Goregaokar
ad2c65bd1b Also suggest .copied() when .clone() is called on a Copy type 2019-04-15 14:39:41 -07:00
Manish Goregaokar
d2f7ae70ae Suggest .copied() instead of .cloned() in map_clone when dealing with references 2019-04-15 14:32:39 -07:00
flip1995
445fa3b529
Deny rustc internal lints 2019-04-15 13:21:52 +02:00
flip1995
5361b842d1
Remove clippy::default_hash_types internal lint 2019-04-15 13:21:52 +02:00
flip1995
0973f68fb8
Enable -Zunstable-options in .cargo/config 2019-04-15 13:03:07 +02:00
bors
fbb3a47b90 Auto merge of #3961 - rust-lang:rustup, r=matthiaskrgr
Rust upgrade to rustc 1.35.0-nightly (9cd61f025 2019-04-14)

Handles breakages from https://github.com/rust-lang/rust/pull/59877

r? @oli-obk @matthiaskrgr
2019-04-14 21:08:00 +00:00
Manish Goregaokar
2156f6733e Clean up unused cx parameters 2019-04-14 13:23:43 -07:00
Manish Goregaokar
3c93a95b1f HirIdify ReadVisitor 2019-04-14 13:18:34 -07:00
Manish Goregaokar
0c6956f8ce Use _from_hir_id APIs 2019-04-14 13:15:20 -07:00
Manish Goregaokar
1b2f2be085 Remove now-unnecessary calls to node_to_hir_id 2019-04-14 13:11:31 -07:00
bors
6505794bc6 Auto merge of #3960 - phansch:fix_except, r=flip1995
Remove `except` in suspicious_else_formatting

96c34e85 contains the fix:

This was causing two different ICEs in #3741. The first was fixed in #3925.

The second one is fixed with this commit: We just don't `expect` anymore.
If the snippet doesn't contain an `else`, we stop emitting the lint because
it's not a suspiciously formatted else anyway.

Unfortunately I wasn't able to provide a minimal test case, but I think it's
fine since it's just ignoring the `None` case now.

And ad27e3ff cleans up the lint code to use `if_chain`.

Fixes #3741 once more.
2019-04-14 15:56:58 +00:00
bors
422ae77cae Auto merge of #3956 - rust-lang:beta-clog, r=phansch
Beta changelog

Maintain a changelog for beta so the release team can easily include important additions in the release blog posts.

r? @phansch, @oli-obk
2019-04-14 15:17:40 +00:00
Manish Goregaokar
737e45ad2d Link to ICEs 2019-04-14 08:17:01 -07:00
Philipp Hansch
02afbb9d61 Update CHANGELOG.md
Co-Authored-By: Manishearth <manishsmail@gmail.com>
2019-04-14 08:14:48 -07:00
Philipp Hansch
289a9af801
cargo fmt 2019-04-14 15:07:15 +02:00
bors
b1f05de7c5 Auto merge of #3951 - phansch:add_combine_integration_test, r=phansch
Add Marwes/combine to integration tests

repo link: https://github.com/Marwes/combine

`combine` uses a lot of macros internally, has been downloaded more than 200_000
times and is also a dependency of [`redis-rs`](https://crates.io/crates/redis).

Clippy also previously ICEd on combine in #3747 so I think it would be
good to have this crate as an integration test.
2019-04-14 09:46:47 +00:00
Philipp Hansch
ad27e3ff9b
Refactor suspicious_else_formatting using if_chain 2019-04-14 11:12:51 +02:00
Philipp Hansch
96c34e85c4
Remove except in suspicious_else_formatting
This was causing two different ICEs in #3741.
The first was fixed in #3925.

The second one is fixed with this commit: We just don't `expect`
anymore. If the snippet doesn't contain an `else`, we stop emitting the
lint because it's not a suspiciously formatted else anyway.
2019-04-14 11:04:41 +02:00
bors
d19b66e900 Auto merge of #3959 - rust-lang:rustup, r=phansch
Rust upgrade to rustc 1.35.0-nightly (00856722b 2019-04-13)

r? @phansch @oli-obk
2019-04-14 09:00:33 +00:00
Manish Goregaokar
1366b9516b Rust upgrade to rustc 1.35.0-nightly (00856722b 2019-04-13) 2019-04-13 18:57:16 -07:00
Manish Goregaokar
22b9366e75 Beta changelog 2019-04-13 15:05:25 -07:00
bors
5939b6131f Auto merge of #3950 - phansch:update_changelog, r=Manishearth
Update changelog for Rust 1.34.0

[Rendered](https://github.com/phansch/rust-clippy/blob/update_changelog/CHANGELOG.md#rust-134-2019-04-10)
2019-04-13 17:52:25 +00:00
Philipp Hansch
4e72d1eb8c
Add Marwes/combine to integration tests
repo link: https://github.com/Marwes/combine

`combine` uses a lot of macros internally, has been downloaded more than 200_000
times and is also a dependency of [`redis-rs`](https://crates.io/crates/redis).

Clippy also previously ICEd on combine in #3747 so I think it would be
good to have this crate as an integration test.
2019-04-13 13:21:14 +02:00