Mateusz Gacek
1f2d01641d
wrong_self_convention: Enhance lint message
2021-03-19 20:29:55 +01:00
Mateusz Gacek
ea15fb2177
wrong_self_convention: to_
respects Copy
types
...
More details here:
https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
2021-03-17 22:00:46 +01:00
bors
56161b2982
Auto merge of #6917 - MysteryJump:fix-manual-unwrap-or-const-fn, r=giraffate
...
Fix false-positive `manual_unwrap_or` inside const fn
Fixes #6898
changelog: Fix false-positive for manual_unwrap_or in const fn.
2021-03-17 04:34:15 +00:00
Yukio Tanaka
02ceeb59d4
Use in_constant instead of is_const
2021-03-17 00:06:42 +09:00
flip1995
bdf2dceec1
Get rid of some unused dependecies
2021-03-16 14:51:57 +01:00
Yukio Tanaka
c5b3a719ed
Fix FP of manual_unwrap_or
in const fn
2021-03-16 19:46:40 +09:00
Yoshitomo Nakanishi
5a439f5a82
Remove unit_types::utils::is_unit
2021-03-16 11:28:53 +09:00
Yoshitomo Nakanishi
6211b49ac1
Move unit_arg to its own module
2021-03-16 11:28:53 +09:00
Yoshitomo Nakanishi
1bb221243b
Move unit_cmp to its own module
2021-03-16 11:27:42 +09:00
Yoshitomo Nakanishi
d17f54538f
Move let_unit_value to its own module
2021-03-16 11:27:02 +09:00
Yoshitomo Nakanishi
37bffb7797
Extract utility functions to utils.rs
2021-03-16 11:25:46 +09:00
Yoshitomo Nakanishi
ecbef77bd7
Extract lints of unit_types group from types group
2021-03-16 11:25:46 +09:00
Cameron Steffen
1c3a3e7dc6
Don't re-export clippy_utils::diagnostics::*
2021-03-15 20:06:01 -05:00
bors
d7a23112e3
Auto merge of #6914 - camsteffen:source-utils, r=Manishearth
...
Move some utils to `clippy_utils::source`
changelog: none
Continues #6907
2021-03-16 00:08:01 +00:00
bors
0929a24d72
Auto merge of #6828 - mgacek8:issue_6758_enhance_wrong_self_convention, r=flip1995
...
wrong_self_convention: fix lint in case of `to_*_mut` method
fixes #6758
changelog: wrong_self_convention: fix lint in case of `to_*_mut` method. When a method starts with `to_` and ends with `_mut`, clippy expects a `&mut self` parameter, otherwise `&self`.
Any feedback is welcome. I was also thinking if shouldn't we treat `to_` the same way as `as_`. Namely to accept `self` taken: `&self` or `&mut self`.
2021-03-15 22:36:57 +00:00
Cameron Steffen
6fc52a63d1
Move some utils to clippy_utils::source module
2021-03-15 15:34:15 -05:00
Cameron Steffen
eb7f8d6089
Move some utils to ty_utils
2021-03-15 13:44:09 -05:00
Ben Boeckel
ecf0c76c36
Fix suspicious_map false positives
2021-03-14 16:31:55 -05:00
bors
52c25e9136
Auto merge of #6895 - iobtl:reformat_unnecessary_cast, r=llogiq
...
replace span_lint with span_lint_and_sugg along with error message
fixes : #6874
changelog: none
apologies if this may not be the most idiomatic way of doing it, any advice on changes (if any) would be greatly appreciated.
2021-03-14 15:01:01 +00:00
iobtl
1054eb0c85
use lint_unnecessary_cast for literals, suggest _
if not present
2021-03-14 08:09:08 +08:00
bors
781de34222
Auto merge of #6859 - magurotuna:if_then_some_else_none, r=giraffate
...
Implement new lint: if_then_some_else_none
Resolves #6760
changelog: Added a new lint: `if_then_some_else_none`
2021-03-13 15:54:54 +00:00
bors
92b9677864
Auto merge of #6820 - mgacek8:issue_6562_enhance_mem_replace_with_default_with_other_ctors, r=phansch
...
mem_replace_with_default: recognize some std library ctors
fixes #6562
changelog: mem_replace_with_default: recognize some common constructors equivalent to `Default::default()`
2021-03-13 15:43:00 +00:00
Jason Newcomb
2713ad4342
Properly lint macro arguments for explicit_deref_methods
2021-03-13 08:40:01 -05:00
Jason Newcomb
704f7a8e50
Keep track of whether deref
or deref_mut
was called
...
Remove more unnecessary code
2021-03-13 08:39:59 -05:00
Jason Newcomb
1666e43cc0
Remove unneeded code.
2021-03-13 08:39:56 -05:00
Jason Newcomb
a261bc5fad
Make explicit_deref_methods
check for multiple deref calls
...
Fix suggestion for `explicit_deref_methods`. Sometimes `&**` is needed, sometimes nothing is needed.
Allow `explicit_deref_methods` to trigger in a few new contexts.
`explicit_deref_methods` will now consider ufcs calls
2021-03-13 08:39:48 -05:00
iobtl
6d2236f503
replace span_lint with span_lint_and_sugg along with error message
2021-03-13 16:54:59 +08:00
bors
65d046c9ad
Auto merge of #6892 - matthiaskrgr:inc_struct_ctor, r=Y-Nak
...
inconsistent_struct_constructor: try to make message and lint description a bit clearer
changelog: inconsistent_struct_constructor: try to make message and lint description a bit clearer
r? `@ghost`
2021-03-13 04:52:40 +00:00
Mateusz Gacek
41be515062
mem_replace_with_default: use diagnostic items intead of paths
2021-03-12 13:03:07 -08:00
Mateusz Gacek
c86ba7f92d
mem_replace_with_default: recognize some std library ctors
2021-03-12 12:57:54 -08:00
Matthias Krüger
6bc5fe4a88
inconsistent_struct_constructor: try to make message and lint description a bit clearer
2021-03-12 20:41:43 +01:00
Yoshitomo Nakanishi
93ee80ac3e
Use sym::Iterator instead of paths::ITERATOR
2021-03-13 02:10:54 +09:00
Yusuke Tanaka
11d2af7e96
Improve suggestion and make it work for macros
2021-03-12 20:46:46 +09:00
Mateusz Gacek
2547edb842
wrong_self_convention: fix lint in case of to_*_mut
method
...
When a method starts with `to_` and ends with `_mut`, it should expect a `&mut self` parameter,
otherwise `&self`.
2021-03-11 23:54:50 -08:00
Takayuki Maeda
83a955335f
fix interning-defined-symbol error
2021-03-11 20:18:33 +09:00
Takayuki Maeda
99f860768c
remove unused imports
2021-03-11 20:02:29 +09:00
Takayuki Maeda
c711de28ee
move expect_fun_call to its own module
2021-03-11 19:40:50 +09:00
Takayuki Maeda
f49349bf33
move or_fun_call to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
b0824bf75f
move map_unwrap_or to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
5557596926
move option_map_or_none to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
bbed852f6f
unnecessary_fold to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
78e572c627
move useless_asref to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
caaba8270c
move clone_on_copy to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
171c4c1485
move iter_skip_next to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
24909fabd2
move map_flatten and search_is_some to their own modules
2021-03-11 19:40:24 +09:00
Takayuki Maeda
37ba779a53
move flat_map_identity to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
f430384f04
move filter_map_flat_map to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
6d941616f9
move filter_flat_map to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
2baf043c37
move filter_map_next to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
805dcd12d4
move filter_map_map to its own module
2021-03-11 19:40:24 +09:00