Commit graph

5665 commits

Author SHA1 Message Date
Takayuki Maeda
0edd5f881d remove the use of paths 2021-03-18 01:06:24 +09:00
Takayuki Maeda
602bcf3e4f move get_hint_if_single_char_arg to methods/utils.rs 2021-03-18 00:59:45 +09:00
Takayuki Maeda
27963c8dce move chars_last_cmp_with_unwrap to its own module 2021-03-18 00:59:45 +09:00
Takayuki Maeda
4d1f2bc565 extract conditions for single_char_pattern into its own module 2021-03-18 00:59:44 +09:00
Takayuki Maeda
7a7fcc0eda extract condition for into_iter_on_ref to its own module 2021-03-18 00:59:43 +09:00
Takayuki Maeda
d380769952 extract conditions for from_iter_instead_of_collect into its own module 2021-03-18 00:58:35 +09:00
Takayuki Maeda
62490c41af extract conditions into modules 2021-03-18 00:51:49 +09:00
Takayuki Maeda
3d9b45df0f move single_char_add_str to its own module 2021-03-18 00:51:18 +09:00
Takayuki Maeda
4843084946 use clippy_utils::ty::is_type_diagnostic_item 2021-03-18 00:51:18 +09:00
Takayuki Maeda
f0f7871920 fmt 2021-03-18 00:51:18 +09:00
Takayuki Maeda
b6597eec0b remove unused arguments 2021-03-18 00:51:18 +09:00
Takayuki Maeda
0c81311bf0 extract a condition into a function. 2021-03-18 00:51:18 +09:00
Takayuki Maeda
f0a101d81d remove a needless variable 2021-03-18 00:51:18 +09:00
Takayuki Maeda
1bec8b6065 use derefs_to_slice in methods/utils.rs 2021-03-18 00:51:16 +09:00
Takayuki Maeda
e578a536c7 move derefs_to_slice to methods/utils.rs 2021-03-18 00:49:50 +09:00
Takayuki Maeda
c07c046b31 refactor string_extend_chars: return when obj type is not string 2021-03-18 00:49:50 +09:00
Takayuki Maeda
058d8c878a move chars_cmp_with_unwrap, chars_last_cmp and chars_next_cmp_with_unwrap to their own modules 2021-03-18 00:49:48 +09:00
Takayuki Maeda
94fb2b58a3 move chars_cmp and chars_next_cmp to its own modules 2021-03-18 00:49:03 +09:00
Cameron Steffen
565400d1f9 Add clippy_utils::paths imports 2021-03-17 09:31:20 -05:00
Cameron Steffen
0743e841f0 Don't re-export clippy_utils::* 2021-03-17 09:13:52 -05:00
bors
8af28840d2 Auto merge of #6805 - matthiaskrgr:uca_nopub_6803, r=flip1995
upper_case_acronyms: don't warn on public items

Fixes #6803

changelog: upper_case_acronyms: ignore public items
2021-03-17 10:53:02 +00:00
bors
d695bfc56f Auto merge of #6821 - Jarcho:write_literal_suggestion, r=flip1995
Write literal suggestion

fixes: #6768

changelog: Add suggestion to `write_literal` and `print_literal` lints
changelog: Change `use_debug` to point only at the format string
2021-03-17 09:49:20 +00: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
Jason Newcomb
d45873b4c1
Remove SmallVec 2021-03-16 12:27:21 -04:00
Jason Newcomb
a7fa2a6fa8
Add suggestion to write_literal and print_literal
Don't lint on a mixture of raw and regular strings
Fix spans in format strings
2021-03-16 12:13:46 -04:00
Jason Newcomb
4c1047167d
More specific spans for use_debug lint 2021-03-16 12:10:40 -04:00
Jason Newcomb
4450c21f51
Keep track of spans in format strings 2021-03-16 12:10:31 -04: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