Commit Graph

2196 Commits

Author SHA1 Message Date
Wilco Kusee
ea7eb49b47 Disable deprecated_cfg_attr lint for inner attributes 2019-01-13 11:53:43 +01:00
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
Konrad Borowski
27ea638a15 Move cast_ref_to_mut list to correctness group 2019-01-07 14:39:56 +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
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
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
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
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
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
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
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
bors
0a6593cd1b Auto merge of #3603 - xfix:random-state-lint, r=phansch
random_state lint
2019-01-03 02:00:46 +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
Wilco Kusee
f38fb56baf Limit infinite_iter collect() check to known types 2018-12-31 13:38:31 +01:00
bors
85ba5f0f17 Auto merge of #3608 - phansch:improve_util_docs, r=oli-obk
Some improvements to util documentation

None
2018-12-31 12:03:28 +00:00
Philipp Hansch
cc76384807
Some improvements to util documentation 2018-12-31 12:12:50 +01:00
bors
f2fd8e71e9 Auto merge of #3606 - detrumi:blacklisted_name_hashset, r=phansch
Use hashset in `blacklisted_name` lint
2018-12-31 10:22:06 +00:00
Wilco Kusee
d1dfd3e96f Use hashset for name blacklist 2018-12-31 10:44:27 +01:00
bors
6f3912850a Auto merge of #3590 - jorpic:i3559-if_same_then_else, r=phansch
Fix if_same_then_else false positive

This fixes false positive in #3559.
The problem was that `SpanlessEq` does not check patterns in declarations. So this two blocks considered equal.
```rust
if true {
    let (x, y) = foo();
} else {
   let (y, x) = foo();
}
```
Not sure if the proposed change is safe as `SpanlessEq` is used extensively in other lints, but I tried hard to come up with counterexample and failed.
2018-12-31 09:25:18 +00:00
bors
529f698c23 Auto merge of #3599 - xfix:use-hash-set-for-valid-idents, r=oli-obk
Use an FxHashSet for valid idents in documentation lint
2018-12-30 17:46:01 +00:00
Konrad Borowski
978e3ac2cf Use node_id_to_type_opt instead of node_it_to_type in random_state 2018-12-30 13:40:27 +01:00
bors
735607c1f9 Auto merge of #3588 - detrumi:tuple_struct_use_self, r=phansch
`use_self` for tuple structs

Fixes #3498
2018-12-30 11:12:55 +00:00
Max Taldykin
911a752561 Check pattern equality while checking declaration equality 2018-12-30 14:01:56 +03:00
Konrad Borowski
1130bbc26f Merge branch 'master' of https://github.com/rust-lang/rust-clippy into random-state-lint 2018-12-30 11:43:20 +01:00
bors
aee138a7cf Auto merge of #3597 - xfix:match-ergonomics, r=phansch
Match ergonomics (lints from A to B)
2018-12-30 10:40:36 +00:00
Wilco Kusee
1d10de66de Remove false negatives from known problems 2018-12-30 08:23:39 +01:00
Wilco Kusee
ab42ba4f54 Implement use_self for tuple structs 2018-12-30 08:23:38 +01:00
Wilco Kusee
0f3dcdc3aa Document known problems 2018-12-30 08:20:49 +01:00
Konrad Borowski
a6c4eaa93c random_state lint 2018-12-30 02:45:34 +01:00
Matthias Krüger
e590025f61 rustup https://github.com/rust-lang/rust/pull/56225/
item.name -> item.ident.name
2018-12-30 01:09:24 +01:00
Konrad Borowski
815e434a1f Move constant write checks to temporary_assignment lint
They make more sense here
2018-12-30 00:25:09 +01:00
bors
6cba3da727 Auto merge of #3558 - russelltg:new_without_default_merge, r=flip1995
Merge new_without_default_derive into new_without_default

Closes #3525, deprecating new_without_default_derive and moving both lints into new_without_default.
2018-12-29 17:31:35 +00:00
Konrad Borowski
ab70e0e742 Use an FxHashSet for valid idents in documentation lint 2018-12-29 18:08:53 +01:00
Konrad Borowski
aeabb890d6 Use match ergonomics for booleans lint 2018-12-29 17:38:15 +01:00