Commit graph

5944 commits

Author SHA1 Message Date
bors
54e80c7b34 Auto merge of #4007 - phansch:fix_allowing_toplevel_ref_arg, r=flip1995
Allow allowing of toplevel_ref_arg lint

I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.

Fixes #2332

changelog: Allow allowing of `toplevel_ref_arg` lint
2019-04-20 18:22:53 +00:00
bors
fc1c2f5f1a Auto merge of #4005 - phansch:rustfix_match_as_ref, r=flip1995
Add run-rustfix for match_as_ref lint

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

cc #3630

changelog: none
2019-04-20 17:21:20 +00:00
bors
7a6d5c00d3 Auto merge of #4006 - phansch:fix_module_name_repetitions_fp, r=flip1995
Fix false positive in module_name_repetitions lint

This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.

It was not reporting a location in #3892 because `span.lo()` and `span.hi()` both were 0.

Fixes #3892

changelog: Fix false positive in `module_name_repetitions` lint
2019-04-20 16:58:51 +00:00
Philipp Hansch
60a1759b5f
Add test for derives for used_underscore_binding lint
This closes #852 as I can't reproduce the original issue anymore.
2019-04-20 09:33:13 +02:00
bors
cafbe7f2d9 Auto merge of #4009 - phansch:update_compiletest, r=phansch
Update compiletest_rs

This includes a fix that make ICEs appear in UI tests again.
2019-04-19 17:11:13 +00:00
Philipp Hansch
2ab97a24e7
Update compiletest_rs
This includes a fix that make ICEs appear in UI tests again.
2019-04-19 18:23:25 +02:00
Philipp Hansch
158aa39a7c
Allow allowing of toplevel_ref_arg lint
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
2019-04-19 15:18:32 +02:00
Grzegorz
aa9cf07d56 redundant closure for functions restricted to FnDefs 2019-04-19 15:14:49 +02:00
Philipp Hansch
850c24edd3
Fix false positive in module_name_repetitions lint
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
2019-04-19 12:53:03 +02:00
Philipp Hansch
9a6c82094f
Add run-rustfix for match_as_ref lint
* Extracts `match_as_ref` into separate file
* Adds `// run-rustfix` to `tests/ui/match_as_ref.rs`
2019-04-19 12:08:34 +02:00
bors
12e8075d91 Auto merge of #3989 - flip1995:assert_on_const, r=phansch
Don't trigger assertions_on_constants on debug_assert!(false)

Fixes #3948
Fixes #3765

changelog: Fix `debug_assert!` false positive on `assertions_on_constants` lint
2019-04-19 09:57:35 +00:00
bors
0d9ef393b8 Auto merge of #3990 - felixrabe:patch-1, r=flip1995
Typo

changelog: none
2019-04-18 23:16:15 +00:00
bors
77fbdb6494 Auto merge of #3978 - phansch:rustfix_len_zero, r=flip1995
Add run-rustfix for len_zero lint

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

cc #3630
2019-04-18 21:18:23 +00:00
Felix Rabe
b4f2200d5c
Typo 2019-04-18 15:08:14 +02:00
flip1995
10cd28900f
Fix dogfood error 2019-04-18 13:37:20 +02:00
bors
c6e43b1ba7 Auto merge of #3954 - andrehjr:add-lint-path-buf-overwrite, r=flip1995
Add Lint PathBufPushOverwrite

Closes #3923

This is a very simple Lint that checks if push is being called with a Root Path. Because that can make it overwrite the previous path.

I used std::path::Path to check if it's root, in order to keep it working across windows/linux environments instead of checking for '/'. Is that alright?

On the `if_chain!` block, Is there a way to make it short while getting the value of the first argument? I got the example from other lints.

Note that this is first Lint, I hope I got everything covered  🚀
2019-04-18 11:29:43 +00:00
André Luis Leal Cardoso Junior
7e9cb5b84a Add lint PathBufPushOverwrite 2019-04-18 08:05:55 -03:00
bors
6feed2713c Auto merge of #3985 - phansch:move_some_cast_tests, r=flip1995
Move two cast_lossless tests to their correct files

First part of checking off the `tests/ui/cast.rs` checkbox in #3630.
2019-04-18 10:06:55 +00:00
flip1995
88359a136f
Update *.stderr file 2019-04-18 12:05:09 +02:00
flip1995
834ad76806
Remove code duplication 2019-04-18 12:04:46 +02:00
flip1995
40218bae0c
Format code 2019-04-18 11:50:45 +02:00
flip1995
5b836e344c
Add test for debug_assert!(false) 2019-04-18 11:48:19 +02:00
flip1995
be98df5ac3
Don't lint debug_assert!(false) 2019-04-18 11:47:39 +02:00
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
8163a1a5f8
Move two cast_lossless tests to their correct files
First part of checking off the `tests/ui/cast.rs` checkbox in #3630.
2019-04-18 06:54:32 +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
bae7d29dbe
Add run-rustfix for len_zero lint
* Extracts len_without_is_empty into separate file
* Adds `// run-rustfix` to `tests/ui/len_zero.rs`
2019-04-16 21:46:07 +02: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