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
Vadim Petrochenkov
e72d28352c
ast: Reduce size of ExprKind
by boxing fields of ExprKind::Struct
2021-03-16 11:41:24 +03:00
Vadim Petrochenkov
35e8be7407
ast/hir: Rename field-related structures
...
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")
Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03: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
Roxane
9d5daa6f45
Fix error after rebase
2021-03-15 13:16:18 -04:00
Roxane
7926664876
Add comments with examples and tests
2021-03-15 13:16:04 -04:00
Roxane
0ab2bcd182
Add fake_read() to clippy
2021-03-14 19:45:24 -04: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
flip1995
a189df12bd
Clippy: HACK! Fix bootstrap error
...
This will be removed in the next sync, once beta is at 1.52. Until then
this hack avoids to put `cfg(bootstrap)` into Clippy.
2021-03-12 15:32:35 +01:00
flip1995
f2f2a005b4
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
2021-03-12 15:30:50 +01: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
Takayuki Maeda
183daeb961
move filter_map to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
2561b7ea06
move from_iter_insteam_of_collect to its own module
2021-03-11 19:40:24 +09:00
Takayuki Maeda
0c8d143515
move into_iter_on_ref and single_char_pattern to their own modules
2021-03-11 19:40:22 +09:00
Takayuki Maeda
805aa47f43
move single_char_push_string to its own module
2021-03-11 19:40:00 +09:00
Takayuki Maeda
8006dab817
move single_char_insert_string to its own module
2021-03-11 19:40:00 +09:00
Takayuki Maeda
2ade32ddf2
move string_extend_chars and clone_on_ref_ptr to their own module
2021-03-11 19:40:00 +09:00
Takayuki Maeda
b5d809a660
move wrong_self_convention to its own module
2021-03-11 19:40:00 +09:00
Takayuki Maeda
5912ca986c
move iter_nth, iter_nth_zero and iterator_step_by_zero to their own module
2021-03-11 19:39:58 +09:00
Takayuki Maeda
3fe099ba8d
move iter_next_slice to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
db91d9cf9a
move map_collect_result_unit to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
9b0a42b67d
move zst_offset to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
6376da70be
replace lints
and lint
with check
2021-03-11 19:37:16 +09:00
Takayuki Maeda
45ee914df0
move iter_cloned_collect to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
35147d4cf3
move uninit_assumed_init to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
8623b331ee
move filetype_is_file to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
60a053725e
move suspicious_map to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
110dac7f58
move option_as_ref_deref to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
483bac2dc0
move skip_while_next to its own module
2021-03-11 19:37:16 +09:00
Takayuki Maeda
f0f07accbc
move expect_used, filter_next, get_unwrap, ok_expect and unwrap_used to their own modules
2021-03-11 19:37:13 +09:00
flip1995
9c1dd0c227
Fix remaining dogfood errors (internal lints)
2021-03-11 10:57:49 +01:00
flip1995
78c740e2f3
Merge remote-tracking branch 'upstream/master' into rustup
2021-03-11 10:37:58 +01:00
bors
8222d48cde
Auto merge of #6814 - hyd-dev:issue-6486, r=flip1995
...
Fix false positives on procedural macros of `missing_inline_in_public_items` lint
Fixes #6486 .
changelog: Fix false positives on procedural macros of `missing_inline_in_public_items` lint.
2021-03-10 16:40:33 +00:00
bors
a1e25a957e
Auto merge of #6794 - camsteffen:needless-borrowed-ref, r=flip1995
...
Improve needless_borrowed_ref docs
changelog: none
I think "borrowed ref" is a confusing description for this lint. Destructuring a reference is the opposite of borrowing. So I updated the wording throughout the docs. Unfortunately this nit applies to the name of the lint itself, but I won't bother changing that. One motivation for these changes is to clarify the difference between this lint and `needless_borrow` (they are actually quite different). Let me know if I need to clarify anything or if you disagree with any changes.
2021-03-10 16:27:18 +00:00
bstrie
7406c12885
Deprecate items that accidentally weren't deprecated
...
Fixes #82080
2021-03-09 19:09:20 -05:00
Camille GILLOT
6c668266c0
Remove hir::Expr::attrs.
2021-03-09 19:27:58 +01:00