Commit Graph

1835 Commits

Author SHA1 Message Date
flip1995
3c68d892ff
Update custom_ice_message.stderr 2020-01-16 16:01:36 +01:00
bors
be09bb47db Auto merge of #5034 - ThibsG:MatchWildErrArmImprove5024, r=flip1995
Match wild err arm improvements

This lint should trigger on other identifiers which have `_` prefix (such as `_e`) and only if they are unused in the panic block.

_Note_: the `is_unused` function is greatly inspired from `pat_is_wild` function in [loops lints](43ac9416d9/clippy_lints/src/loops.rs (L1689)).
I've been considering doing some refactoring, maybe in utils. Maybe this PR or a new one. What do you think ?

fixes #5024

changelog: none
2020-01-15 21:17:21 +00:00
Andre Bogus
2797b64f7e Omit doc safety/errors header checking for main 2020-01-14 18:20:56 +01:00
bors
c24a42289b Auto merge of #4543 - xiongmao86:issue4503, r=flip1995
Fix issue4503

Fixes #4503.

changelog: Add a lint checking user are using FileType.is_file() method and suggest using !FileType.is_dir().

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`
2020-01-13 22:09:39 +00:00
bors
05cb0df748 Auto merge of #5033 - JohnTitor:split-use-self, r=flip1995
Split up `use_self` ui test

Part of #2038

changelog: none
2020-01-13 20:21:04 +00:00
ThibsG
d3c76b5b2a Change note message 2020-01-13 16:25:35 +01:00
ThibsG
e5c9073f9c Better binding name on Err for note 2020-01-13 16:25:35 +01:00
ThibsG
f79c47f28d Match underscore-prefixed variable also 2020-01-13 16:25:35 +01:00
Yuki Okushi
ce1c6b285d Rustup to rust-lang/rust#68045 2020-01-13 21:55:57 +09:00
xiongmao86
77c48ca341 Fix grammar error. 2020-01-12 19:54:17 +08:00
xiongmao86
8d3cc6b8a9 Change lint message. 2020-01-12 19:54:17 +08:00
xiongmao86
8d333a3cbb Extend spans to include !. 2020-01-12 19:54:17 +08:00
xiongmao86
a1f81355a7 format codebase. 2020-01-12 19:54:17 +08:00
xiongmao86
3c59eaf91c Add lint logic. 2020-01-12 19:54:17 +08:00
xiongmao86
3a788452e2 Add test. 2020-01-12 19:54:17 +08:00
Yuki Okushi
291f2cbeb8 Split up use_self ui test 2020-01-12 06:08:58 +09:00
Yuki Okushi
11fb749a96 Comment out half-open patterns' tests 2020-01-12 03:05:47 +09:00
Yuki Okushi
39947992b5 Rustup to rust-lang/rust#67806 2020-01-11 21:50:00 +09:00
Yuki Okushi
10cf141ebb Apply review comments 2020-01-11 19:39:43 +09:00
Yuki Okushi
77e5a1b227 Split up missing-doc ui test 2020-01-10 04:35:37 +09:00
bors
ac795a6f3a Auto merge of #4960 - ThibsG:patterns_with_wildcard_#4640, r=flip1995
New lint: pats_with_wild_match_arm

Wildcard use with other pattern in same match arm.

The wildcard covers other(s) pattern(s) as it will match anyway.

changelog: add new lint when multiple patterns (including wildcard) are used in a match arm.

Fixes #4640.
2020-01-09 13:51:00 +00:00
bors
0da0ae3aa6 Auto merge of #5022 - flip1995:useless_attr, r=phansch
Fix useless_attribute suggestion

Fixes #5021

changelog: Fix [`useless_attribute`] suggestion, which tripped rustfix
2020-01-08 20:28:19 +00:00
flip1995
6eba66532c
Add regression test for useless_attribute lint 2020-01-08 17:47:01 +01:00
bors
52b9e704c6 Auto merge of #5017 - sinkuu:mir_no_opt_fallout, r=flip1995
Fix redundant_clone lint not working with PathBuf and OsString

https://github.com/rust-lang/rust-clippy/pull/4825 diabled MIR optimization in clippy, including `rustc_mir::transform::InstCombine` which reduces `&(*x)` to `x`. This PR tries to unwrap `&*` when looking into `mir::Rvalue`s.

Fixes #5014.

---

changelog: fixed `redundant_clone` lint not working with `PathBuf` and `OsString`
2020-01-08 12:09:45 +00:00
Yuki Okushi
787106c380 Normalize lint messages in cast_precision_loss 2020-01-08 16:36:02 +09:00
Shotaro Yamada
99eec3f54f Fix redundant_clone 2020-01-08 14:18:00 +09:00
ThibsG
0fa0df9efb Span help without suggestion 2020-01-07 19:10:59 +01:00
ThibsG
8ae8b08e32 Change lint name to WILDCARD_IN_OR_PATTERNS 2020-01-07 18:48:16 +01:00
ThibsG
58deaad42d Handle case for non-exhaustive enums 2020-01-07 18:48:16 +01:00
ThibsG
d60c6f9398 Move to complexity and adapt test
- test wildcard_enum_match_arm has been impacted by this new lint
2020-01-07 18:48:16 +01:00
ThibsG
96c4198832 New lint: pats_with_wild_match_arm
- Wildcard use with other pattern in same match arm
2020-01-07 18:48:16 +01:00
Yuki Okushi
abc49c3139 Bless 32bit test 2020-01-07 19:56:21 +09:00
Yuki Okushi
f7a93f029c Apply suggestion from code review 2020-01-07 18:38:12 +09:00
Yuki Okushi
07e33633a3 Update stderrs 2020-01-07 18:38:12 +09:00
bors
fdccfe7bca Auto merge of #5011 - JohnTitor:split-collapsible-if, r=flip1995
Split up `collapsible_if` ui test

Part of #2038

changelog: none
2020-01-07 08:45:14 +00:00
Yuki Okushi
175c78bc17 Split up collapsible_if ui test 2020-01-07 15:06:23 +09:00
Krishna Sai Veera Reddy
18060eb81e Split test cases into separate files 2020-01-06 16:39:31 -08:00
Krishna Sai Veera Reddy
9e6a6069a7 Add lint to detect usage of invalid atomic ordering
Detect usage of invalid atomic ordering modes such as
`Ordering::{Release, AcqRel}` in atomic loads and
`Ordering::{Acquire, AcqRel}` in atomic stores.
2020-01-06 16:39:31 -08:00
Yuki Okushi
2213989a01 Do not trigger let_and_return lint on macros 2020-01-07 05:26:20 +09:00
Yuki Okushi
65d15340cd Fix test again 2020-01-07 02:04:10 +09:00
Yuki Okushi
ce36335cf0 Pick up lost property 2020-01-07 01:54:51 +09:00
Yuki Okushi
2f2eaf8b7e Rustup to rust-lang/rust#67886 2020-01-07 01:46:33 +09:00
Andre Bogus
539cd25262 External macro check for missing_*_doc 2020-01-04 20:19:14 +01:00
Brad Sherman
ab5ff0352e Add lint for iter.nth(0)
- Encourage iter.next() rather than iter.nth(0), which is less readable
2020-01-04 11:20:11 -06:00
bors
fa9b85d4df Auto merge of #4881 - krishna-veerareddy:issue-4871-use-mem-take, r=flip1995
Use `mem::take` instead of `mem::replace` when applicable

`std::mem::take` can be used to replace a value of type `T` with `T::default()` instead of `std::mem::replace`.

Fixes issue #4871

changelog: Added lint for [`mem_replace_with_default`]
2020-01-04 08:09:43 +00:00
Andre Bogus
47972cdf12 No #[no_mangle] must_use_candidate functions 2020-01-03 17:21:36 +01:00
bors
2e8c3c3e9e Auto merge of #4975 - JohnTitor:fix-4968, r=phansch
Fix ICE on `unsound_collection_transmute`

Fixes #4968

Check if `Ty`s are normalizable. It might show hidden false negative, I'm not sure.
Also, the regression tests are placed on two dirs, so move them to `/crashes`. I think it will be easier to find the right place.

changelog: Fix ICE on `unsound_collection_transmute`
2020-01-03 08:48:05 +00:00
Yuki Okushi
c6aeda7bd5 Move use_self_macro into crashes/auxiliary 2020-01-03 17:03:07 +09:00
bors
304edf39c3 Auto merge of #4978 - mikerite:fix-4958, r=phansch
Fix bad `explicit_into_iter_loop` suggestion

Fixes #4958

changelog: Fix bad `explicit_into_iter_loop` suggestion
2020-01-03 05:59:19 +00:00
Krishna Veera Reddy
8b36196cb6 Add if let test case 2020-01-01 23:22:57 -08:00