Commit graph

2736 commits

Author SHA1 Message Date
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
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
Philipp Hansch
c5178e82b4
Rustup to https://github.com/rust-lang/rust/pull/67853
Specifically caused by https://github.com/rust-lang/rust/pull/67786
2020-01-04 11:30:03 +01: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
Yuki Okushi
20318e00ef Add attribute 2020-01-02 09:32:55 +09:00
Michael Wright
ea829bd8c6 Fix bad explicit_into_iter_loop suggestion
Fixes #4958
2020-01-01 07:09:09 +02:00
Krishna Veera Reddy
84a60c3186 Prevent replace_consts lint within match patterns
Currently `replace_consts` lint applies within match patterns but
the suggestion is incorrect as function calls are disallowed in
them. To fix this we prevent the lint from firing within patterns.
2019-12-31 10:33:15 -08:00
Krishna Veera Reddy
a8413a32b3 Remove unnecessary import 2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
c09e79e226 Lint within internal macros without a suggestion 2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
26812f733d Prevent mem_replace_with_default lint within macros
Also added test cases for internal and external macros.
2019-12-31 09:22:34 -08:00
Krishna Veera Reddy
2a75241c1a Add test cases for replace with Default::default() 2019-12-31 09:22:34 -08:00
Krishna Veera Reddy
8db319f957 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`.
2019-12-31 09:22:34 -08:00
Yuki Okushi
de6fe1071b Rename test prefix 2019-12-31 20:55:12 +09:00
Yuki Okushi
50a8582980 Move ICE tests to /crashes 2019-12-31 20:55:12 +09:00
Yuki Okushi
12a3d72462 Add regression test for #4968 2019-12-31 20:55:12 +09:00
bors
cecaca3382 Auto merge of #4634 - m-ober:feature/2320-map-or, r=llogiq
Add real suggestion to option_map_unwrap_or

changelog: Add real suggestion to `option_map_unwrap_or`

Fixes #2320
2019-12-30 15:50:06 +00:00
Micha Ober
c5046fdce5 Add real suggestion to option_map_unwrap_or 2019-12-28 23:24:45 +01:00
mgr-inz-rafal
6223391170 Add tests for new lint (modulo_arithmetic) 2019-12-28 16:46:08 +01:00
Yuki Okushi
6e525fc7b1 Improve tests 2019-12-27 22:07:55 +09:00
Yuki Okushi
b68e65b4da Do not drop suffixes on decimal_literal_representation 2019-12-26 01:22:36 +09:00
bors
a68ef55dbf Auto merge of #4947 - rust-lang:doc-main-extern-crate, r=flip1995
Avoid needless_doctest_main on 'extern crate'

This fixes #4927.

r? @flip1995

changelog: none
2019-12-24 15:03:54 +00:00
bors
1837cbce6c Auto merge of #4885 - rust-lang:mut-key-types, r=flip1995
new lint: mutable_key_type

This fixes #732 - well, partly, it doesn't adress `Hash` impls, but the use of mutable types as map keys or set members

changelog: add `mutable_key_type` lint

r? @flip1995
2019-12-24 13:32:45 +00:00
Andre Bogus
40435acf3d new lint: mutable_key_type 2019-12-24 13:46:19 +01:00
Andre Bogus
129d0cd0f4 Avoid needless_doctest_main on 'extern crate' 2019-12-24 13:42:37 +01:00
Lzu Tao
652666b288 rustup "Add span information to ExprKind::Assign" 2019-12-24 11:25:24 +07:00
Lzu Tao
f5b896451a do minor cleanups
* ToString and AsRef are in prelude, no need to import them
2019-12-24 03:06:52 +07:00
bors
37b7970a7c Auto merge of #4934 - illicitonion:exhaustive_match, r=flip1995
Update wildcard enum match lint for non_exhaustive enums

changelog: wildcard_enum_match_arm gives better suggestions for non_exhaustive enums
2019-12-23 17:00:38 +00:00
bors
b38b026a98 Auto merge of #4823 - Areredify:must_use_res, r=flip1995
Add `let_underscore_must_use` lint

changelog: closes #4812 , added a new `let_underscore_must_use` lint, moved `is_must_use_ty` to utils, added `is_must_use_fn` util function
2019-12-23 06:16:37 +00:00
Lzu Tao
185e608ae2 a few small cleanups 2019-12-23 05:28:23 +07:00