Commit graph

5276 commits

Author SHA1 Message Date
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
bors
5b8496603c Auto merge of #3640 - detrumi:nested_use_self, r=flip1995
Restrict `use_self` on nested items

Fixes #3637
Fixes #3463

These changes make it so that nested items aren't visited any more by the `use_self` lint.

I think visiting nested items should be possible (so that it uses a different `item_path` for the nested item), but I'm not sure whether it's viable and what the best approach would be.
- Can `item_path` be changed to a new `Self` path before visiting the item, and then changing it back afterwards?
- Alternatively, could a new visitor be created, re-using `check_trait_method_impl_decl`?
2019-01-07 18:54:28 +00:00
bors
140c1650e8 Auto merge of #3600 - xfix:cast-ref-to-mut, r=flip1995
cast_ref_to_mut lint

I see this pattern way too often, and it's completely wrong. In fact, due to how common this incorrect pattern is, [the Rustonomicon specifically points this out](https://doc.rust-lang.org/nomicon/transmutes.html).

> - Transmuting an & to &mut is UB
>   - Transmuting an & to &mut is always UB
>   - No you can't do it
>   - No you're not special

This is my first lint.
2019-01-07 18:30:53 +00:00
bors
dd94d3b93c Auto merge of #3641 - hellow554:patch-1, r=flip1995
Add missing ` in default lint
2019-01-07 17:50:48 +00:00
Konrad Borowski
27ea638a15 Move cast_ref_to_mut list to correctness group 2019-01-07 14:39:56 +01:00
Wilco Kusee
466cd076a2
Rustftmt 2019-01-07 14:38:01 +01:00
Konrad Borowski
21d30450b5 Don't import ty::Ref in cast_ref_to_mut lint 2019-01-07 14:37:28 +01:00
Konrad Borowski
6faf1330aa Move a hint to an error message in cast_ref_to_mut lint
This matches mem::transmute::<&T, &mut T> lint in rustc.
2019-01-07 14:37:28 +01:00
Konrad Borowski
1cab4d15a2 Add a note to cast_ref_to_mut lint 2019-01-07 14:37:28 +01:00
Konrad Borowski
fd57874106 Use ty::Ref instead of ty::TyKind::Ref 2019-01-07 14:37:28 +01:00
Konrad Borowski
34daf09aa4 cast_ref_to_mut lint 2019-01-07 14:37:28 +01:00
Marcel Hellwig
a3931229c4
Add missing ` in default lint 2019-01-07 14:32:32 +01:00
Wilco Kusee
351688db78
Improve tests and exclude nested impls 2019-01-07 14:11:53 +01:00
bors
81fa26631c Auto merge of #3638 - mikerite:fix-3625, r=oli-obk
Improve `get_unwrap` suggestion

Handle case where a reference is immediately dereferenced.

Fixes #3625
2019-01-07 08:41:43 +00:00
Michael Wright
d2ea6355a8 Update unwrap_get code review suggestions 2019-01-07 06:22:39 +02:00
Wilco Kusee
7230768998 Update known problems 2019-01-06 15:41:02 +01:00
Wilco Kusee
ff191a808e Restrict use_self on nested items 2019-01-06 15:34:36 +01:00
Michael Wright
4add1e23f9 Improve get_unwrap suggestion
Handle case where a reference is immediately dereferenced.

Fixes 3625
2019-01-06 11:46:03 +02:00
bors
c63b6349b4 Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
Revert the random_state lint.

Remove the random_state lint until it or rustc has been fixed to no longer crash with debug assertions (see #3628)
We can't update clippy in the rustc repo because of this which is blocking nightlies because toolstate is already broken.

fixes #3628
2019-01-05 14:04:31 +00:00
bors
05467abd24 Auto merge of #3626 - phansch:rustfix_works, r=oli-obk
Add run-rustfix where it already works

This PR adds `// run-rustfix` headers to tests for `MachineApplicable` lints where
applying the suggestions works without any errors.
2019-01-05 12:14:30 +00:00
Matthias Krüger
8ff4a1f0a8 Revert "tests: used_underscore_binding_macro: disable random_state lint."
This reverts commit 2b80829fe0.
2019-01-05 10:20:37 +01:00
Matthias Krüger
3389a68834 Revert "Auto merge of #3603 - xfix:random-state-lint, r=phansch"
This reverts commit 0a6593cd1b, reversing
changes made to 5277a1fb6c.

This hopefully fixes #3628
2019-01-05 10:19:04 +01:00
bors
d264e406be Auto merge of #3627 - detrumi:use_self_local_macro, r=phansch
Trigger `use_self` lint in local macros

Closes #2098

The test currently only covers local macros. #2098 suggested this:
> You could add the macro in question into the `mini_macro` subcrate

But that doesn't work for a `macro_rules`:
```
error: cannot export macro_rules! macros from a `proc-macro` crate type currently
```

So I suggest leaving out the test for external macros, as using `in_external_macro` seems straigtforward enough. Alternatives would be to use to add an additional crate (overkill if you ask me), or test with a `proc-macro`.
2019-01-05 08:51:13 +00:00
bors
3bcf67c2cb Auto merge of #3610 - phansch:method_rs_cleanup, r=flip1995
UI test cleanup: Extract lint from methods.rs test

Extracts the `result_map_unwrap_or_else` lint into a separate test file.

This also extracts the `IteratorFalsePositives` struct and impl into
`auxiliary/option_helpers.rs`.

cc #2038
2019-01-05 08:29:25 +00:00
bors
488b8c5f6f Auto merge of #3633 - matthiaskrgr:rustup, r=phansch
rustup (don't know the exact PR unfortunately)
2019-01-05 08:02:50 +00:00
Matthias Krüger
a4b99c6d68 rustup https://github.com/rust-lang/rust/pull/56837 2019-01-05 08:21:56 +01:00
Matthias Krüger
33ec4e5220 rustup (don't know the exact PR unfortunately) 2019-01-05 01:12:33 +01:00
bors
cf3fb908c8 Auto merge of #3631 - phansch:add_itertools_to_integration_tests, r=phansch
Add itertools to integration tests

Mainly because it causes an ICE in https://github.com/rust-lang/rust/issues/57298
and it's a good library to test anyway.
2019-01-04 18:05:17 +00:00
bors
8ac411dd42 Auto merge of #3629 - matthiaskrgr:crash_workaround, r=phansch
tests: used_underscore_binding_macro: disable random_state lint.

Trying to work around a crash (see https://github.com/rust-lang/rust-clippy/issues/3628) in
https://github.com/rust-lang/rust/pull/57303
2019-01-04 17:40:43 +00:00
Philipp Hansch
f8edc39c38
Add itertools to integration tests 2019-01-04 18:01:44 +01:00
Matthias Krüger
2b80829fe0 tests: used_underscore_binding_macro: disable random_state lint.
Trying to work around a crash (see https://github.com/rust-lang/rust-clippy/issues/3628) in
https://github.com/rust-lang/rust/pull/57303
2019-01-04 17:18:19 +01:00
bors
194a91c45d Auto merge of #3601 - xfix:move-constant-write-lint, r=flip1995
Move constant write checks to temporary_assignment lint

They make more sense here

cc #3595
2019-01-04 14:59:11 +00:00
Wilco Kusee
407ff74dcc
Trigger use_self lint in local macros 2019-01-04 13:01:31 +01:00
Philipp Hansch
319f18e54d
Add run-rustfix where it already passes 2019-01-04 11:22:38 +01:00
bors
756b32e1e2 Auto merge of #3623 - phansch:rustup, r=flip1995
rustup: https://github.com/rust-lang/rust/pull/55517

None
2019-01-03 22:29:09 +00:00
Philipp Hansch
d1fffe07c5
rustup: https://github.com/rust-lang/rust/pull/55517 2019-01-03 21:54:57 +01:00
bors
261ebcfbb4 Auto merge of #3622 - m-cat:master, r=phansch
Add ui/for_kv_map test for false positive in #1279

Fixes #1279
2019-01-03 19:49:07 +00:00
bors
c7c75db827 Auto merge of #3621 - Zoxc:parallel, r=phansch
Make clippy work with parallel rustc
2019-01-03 19:27:32 +00:00
John Kåre Alsaker
3af68f831a Make clippy work with parallel rustc 2019-01-03 19:18:06 +01:00
Marcin S
5f0d46cd48 Add ui/for_kv_map test for false positive in #1279 2019-01-03 19:07:21 +01:00
bors
5b8b01e8dc Auto merge of #3519 - phansch:brave_newer_ui_tests, r=flip1995
Integrate rustfix into Clippy test suite

Once the [PR to compiletest-rs](https://github.com/laumann/compiletest-rs/pull/151) is reviewed and merged this fixes #2376.

I will create a separate tracking issue for adding `run-rustfix` to all tests.
2019-01-03 15:08:47 +00:00
Philipp Hansch
ec1395aafb
Update to latest compiletest-rs release 2019-01-03 15:42:59 +01:00
bors
baec524fac Auto merge of #3617 - matthiaskrgr:3462_test, r=phansch
add testcase for #3462
2019-01-03 11:23:57 +00:00
Matthias Krüger
24ff813f54 add testcase for #3462 2019-01-03 11:40:10 +01:00
bors
e6aff691d3 Auto merge of #3615 - matthiaskrgr:rtuVbump, r=phansch
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...

I'm surprised there is no warning since the root cargo.toml specifies 0.1.0 but the subcrate toml actually states 0.1.1.

I should have noticed this in previous pull request but oh well...
2019-01-03 07:20:23 +00:00
Matthias Krüger
a49ed381bd deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case... 2019-01-03 03:19:15 +01:00
bors
0a6593cd1b Auto merge of #3603 - xfix:random-state-lint, r=phansch
random_state lint
2019-01-03 02:00:46 +00:00
bors
5277a1fb6c Auto merge of #3614 - matthiaskrgr:rustc_tool_utils, r=phansch
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
2019-01-03 01:06:53 +00:00
bors
84aa027888 Auto merge of #3607 - detrumi:limit_infinite_iter_to_known_types, r=phansch
Only trigger `infinite_iter` lint for infinitely allocating `collect()` calls

Fixes  #3538

~Oh, I guess this should actually check other methods like `count` as well, not only `collect()`.~
Never mind, `collect` is the only of these functions that allocates a data structure.
2019-01-03 00:12:02 +00:00
Philipp Hansch
a5d3f37c5a
Use compiletest's aux-build header instead of include macro 2019-01-02 22:48:44 +01:00