Commit graph

1966 commits

Author SHA1 Message Date
Wilco Kusee
d3c452265f Add run-rustfix to starts_ends_with 2019-01-13 19:40:14 +01:00
Wilco Kusee
2d11a440dd Add run-rustfix to replace_const test 2019-01-13 19:38:43 +01:00
Wilco Kusee
aa1793e9c4 Add run-rustfix to redundant_field_names 2019-01-13 18:48:54 +01:00
roblabla
79203653d1 Missing docs: don't require documenting Global Asm items.
global_asm! items cannot be documented, the lint still gets triggered
after adding documentation to the macro invocation. Furthermore, even
if we could add documentation to the AST node, rustdoc doesn't render
it anyways.

Playground example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5182df182f0ffbbab4c3107e43368ac3
2019-01-13 16:22:48 +00:00
Wilco Kusee
6f17635f94 Add run-rustfix for precedence test 2019-01-13 14:26:09 +01:00
Wilco Kusee
95f2a9dbfc Add run-rustfix to mem_replace test 2019-01-13 13:55:26 +01:00
Wilco Kusee
9ff821a7e8 Add run-rustfix to map_clone test 2019-01-13 13:10:25 +01:00
Wilco Kusee
fb90fcb610 Add run-rustfix to large_digit_groups 2019-01-13 12:57:13 +01:00
Wilco Kusee
256b641976 Add run-rustfix to into_iter_on_ref 2019-01-13 12:52:51 +01:00
Wilco Kusee
787f5a2c12 Add run-rustfix to infallible_destructuring_match 2019-01-13 12:49:54 +01:00
Wilco Kusee
87407c5e5f Add rustfix to inconsistent_digit_grouping test 2019-01-13 12:44:21 +01:00
Wilco Kusee
40d9f1d9f4 Add run-rustfix to explicit_write test 2019-01-13 12:22:59 +01:00
Wilco Kusee
9f8fb8007c Add run-rustfix to excessive_precision test 2019-01-13 12:09:30 +01:00
Wilco Kusee
29211be896 Add run-rustfix to duration_subsec test 2019-01-13 12:06:28 +01:00
Wilco Kusee
ea7eb49b47 Disable deprecated_cfg_attr lint for inner attributes 2019-01-13 11:53:43 +01:00
Wilco Kusee
c0083e2b98 Add run-rustfix to collapsible_if test 2019-01-13 11:44:45 +01:00
A.A.Abroskin
a9f8d3c8fd add assert(true/false, some message) tests 2019-01-09 21:30:47 +03:00
Abroskin Alexander
7075015f31
Merge branch 'master' into add-lints-aseert-checks 2019-01-09 13:49:40 +03:00
A.A.Abroskin
906b51637c change assert_checks to assertions_on_constants 2019-01-09 13:38:38 +03: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
Wilco Kusee
466cd076a2
Rustftmt 2019-01-07 14:38:01 +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
34daf09aa4 cast_ref_to_mut lint 2019-01-07 14:37:28 +01:00
Wilco Kusee
351688db78
Improve tests and exclude nested impls 2019-01-07 14:11:53 +01:00
A.A.Abroskin
3d9535a106 Add unreachable!() as option 2019-01-07 13:30:17 +03:00
A.A.Abroskin
98c5f37ad2 Add assert(true) and assert(false) lints 2019-01-07 13:30:17 +03:00
Michael Wright
d2ea6355a8 Update unwrap_get code review suggestions 2019-01-07 06:22:39 +02: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
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
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
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
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
Philipp Hansch
a5d3f37c5a
Use compiletest's aux-build header instead of include macro 2019-01-02 22:48:44 +01:00
bors
0fc5857d0b Auto merge of #3609 - codeworm96:fix_test, r=phansch
Fix test for rust-lang/rust#57250

Part of rust-lang/rust#57250.
~~Do not merge. Waiting a nightly with that PR merged.~~
2019-01-02 16:40:10 +00:00
bors
3de9a3de54 Auto merge of #3612 - phansch:copies_cleanup, r=flip1995
UI test cleanup: Extract ifs_same_cond tests

cc #2038
2019-01-02 13:20:38 +00:00
Philipp Hansch
c84a894ed7
rustfmt 2019-01-02 08:15:32 +01:00
Philipp Hansch
3b035373b2
UI test cleanup: Extract ifs_same_cond tests 2019-01-02 07:59:48 +01:00
Philipp Hansch
0c54913afe
Extract IteratorFalsePositives into option_helpers.rs
This was previously duplicated in #3605
2019-01-02 07:49:28 +01:00
Philipp Hansch
b38a2d7ce9
UI test cleanup: Extract for_kv_map lint tests 2019-01-02 07:42:04 +01:00
Philipp Hansch
eaaee23847
UI test cleanup: Extract lint from methods.rs test 2019-01-02 07:23:00 +01:00
Yuning Zhang
5f9a65ffd6 Fix test for rust-lang/rust#57250 2019-01-01 20:34:02 -05:00
Wilco Kusee
f38fb56baf Limit infinite_iter collect() check to known types 2018-12-31 13:38:31 +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
Konrad Borowski
11b957e18d Reformat random_state tests 2018-12-30 14:29:43 +01:00
Philipp Hansch
8c4c458ee9
UI test cleanup: Extract iter_skip_next from methods.rs
cc #2038
2018-12-30 13:46:21 +01:00
Max Taldykin
911a752561 Check pattern equality while checking declaration equality 2018-12-30 14:01:56 +03:00
Wilco Kusee
259ec2dc0e Update test output after rebase 2018-12-30 08:23:39 +01: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
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
ece8b8e7d6 Auto merge of #3598 - xfix:apply-cargo-fix-edition-idioms, r=phansch
Apply cargo fix --edition-idioms fixes
2018-12-29 19:04:11 +00: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
177c639e65 Remove unnecessary use statements after cargo fix 2018-12-29 17:48:21 +01:00
Konrad Borowski
0edb49792f Apply cargo fix --edition-idioms fixes 2018-12-29 17:46:25 +01:00
bors
4d60841205 Auto merge of #3596 - xfix:remove-crate-from-paths, r=flip1995
Remove crate:: prefixes from crate paths

This is somewhat misleading, as those are actually external crates,
and don't need a crate:: prefix.
2018-12-29 16:15:57 +00:00
Konrad Borowski
3f62fc3a7e Remove crate:: prefixes from crate paths
This is somewhat misleading, as those are actually external crates,
and don't need a crate:: prefix.
2018-12-29 16:05:49 +01:00
Konrad Borowski
9fe8a3e52e Support array indexing expressions in unused write to a constant 2018-12-29 15:34:15 +01:00
Konrad Borowski
847898f18f Mark writes to constants as side-effect-less 2018-12-29 15:18:51 +01:00
Philipp Hansch
298aedf2f8
Fix suggestion for unnecessary_ref lint 2018-12-28 20:54:29 +01:00
Philipp Hansch
7d9bf99df1
Update .fixed files via update-references.sh 2018-12-28 20:53:44 +01:00
Philipp Hansch
2ccfd52f5d
Run rustfix on first UI test 2018-12-28 20:53:43 +01:00
Peter Fürstenau
8be7050b74 Fix formatting 2018-12-28 20:52:46 +01:00
Peter Fürstenau
6ee0e22204 Merge remote-tracking branch 'upstream/master' 2018-12-28 20:19:51 +01:00
Russell Greene
d127aed737 Merge new_without_default_derive into new_without_default 2018-12-28 10:57:58 -07:00
flip1995
d2dbd0b8a5
Update *.stderr files 2018-12-28 12:41:12 +01:00
flip1995
9fddb2afce
Use -Zui-testing flag 2018-12-28 12:39:28 +01:00
Matthias Krüger
38fabcbdf2 tests: fix formatting and update test output
fix script one last time™
2018-12-27 17:03:53 +01:00
Andy Russell
cd602c8b18
fix breakage from rust-lang/rust#57088 2018-12-25 16:11:28 -05:00
bors
d9cc71fc42 Auto merge of #3341 - HMPerson1:possibly_missing_else, r=phansch
Teach `suspicious_else_formatting` about `if .. {..} {..}`

We essentially treat bare blocks `{..}` identically to `if .. {..}`, except for different lint messages.

Fixes #3044
2018-12-22 13:26:22 +00:00
Mark Nieweglowski
d395d45ca7 test: panic at map_unit_fn.rs:202 for map() without args 2018-12-22 01:06:02 -05:00
Mark Nieweglowski
a24853709a rm unused file map_unit_fn.stderr
There is no map_unit_fn.rs whose output would be diffed with map_unit_fn.stderr

map_unit_fn.stderr was renamed 8 months ago from option_map_unit_fn.stderr
but option_map_unit_fn.{stderr,rs} both remain and are in use.
2018-12-22 01:04:03 -05:00
HMPerson1
88564b743e
Teach suspicious_else_formatting about if .. {..} {..} 2018-12-20 22:45:37 -05:00
Peter Fürstenau
18584698ee Add failing test 2018-12-19 20:50:18 +01:00
bors
980bcd8c53 Auto merge of #3546 - matthiaskrgr:fix_install, r=oli-obk
Revert "Merge pull request #3257 from o01eg/remove-sysroot"

This reverts commit 041c49c1ed, reversing
changes made to 1df5766cbb.

The PR broke running a cargo-install'd clippy.
The installed clippy would not be able to find a crate for std.

Fixes #3523
Reopens #2874
2018-12-19 12:54:47 +00:00
bors
61de562454 Auto merge of #3554 - klausi:module_name_repeat, r=oli-obk
chore(module_name_repeat): Rename stutter lint to module_name_repeat to avoid ableist language

See #3521
2018-12-18 13:28:12 +00:00
Peter Fürstenau
ee0856cbeb Recomend .as_ref()? in certain situations 2018-12-18 13:57:38 +01:00
bors
176778fe92 Auto merge of #3556 - lucasloisp:bool-ord-comparison, r=oli-obk
Implements lint for order comparisons against bool (#3438)

As described on issue #3438, this change implements linting for `>` and `<` comparisons against both `boolean` literals and between expressions.
2018-12-18 10:11:08 +00:00
Wilco Kusee
24ef8db402
Do not mark as_ref as useless if it's followed by a method call 2018-12-17 21:33:50 +01:00
Lucas Lois
de42dfbab7 Changes lint sugg to bitwise and operator & 2018-12-17 15:32:24 -03:00
flip1995
a44adaa5ed
Rename lint to MODULE_NAME_REPETITIONS 2018-12-17 14:29:19 +01:00
flip1995
60cc6b9319
Add renaming tests 2018-12-17 13:59:09 +01:00
Lucas Lois
bc48890b47 Implements lint for order comparisons against bool 2018-12-16 21:43:32 -03:00
daxpedda
6870638c3f
Fix an endless loop in the tests. 2018-12-16 22:20:05 +01:00