]>
git.lizzy.rs Git - rust.git/log
Jason Newcomb [Tue, 23 Mar 2021 01:38:14 +0000 (21:38 -0400)]
Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments
bors [Wed, 24 Mar 2021 18:42:20 +0000 (18:42 +0000)]
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
Fix false positive in `manual_flatten`
This pull request fixes false positive in `manual_flatten` in case using a slice of references .
closes: #6893
changelog: fix false positive in `manual_flatten`
Takayuki Maeda [Wed, 24 Mar 2021 15:17:43 +0000 (00:17 +0900)]
merge imports
Takayuki Maeda [Wed, 24 Mar 2021 15:15:15 +0000 (00:15 +0900)]
fix false positive in manual_flatten
bors [Tue, 23 Mar 2021 16:25:28 +0000 (16:25 +0000)]
Auto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995
Factor out `SpanlessEq::eq_ty_kind`
changelog: none
Cameron Steffen [Tue, 23 Mar 2021 15:40:27 +0000 (10:40 -0500)]
Factor out eq_ty_kind
bors [Mon, 22 Mar 2021 20:29:13 +0000 (20:29 +0000)]
Auto merge of #6950 - Sciencentistguy:master, r=phansch
Ignore str::len() in or_fun_call lint.
changelog: Changed `or_fun_call` to ignore `str::len`, in the same way it ignores `slice::len` and `array::len`
Closes #6943
bors [Mon, 22 Mar 2021 19:36:22 +0000 (19:36 +0000)]
Auto merge of #6896 - TaKO8Ki:refactor-lints-in-methods-module, r=phansch
Refactor lints in methods module
This PR refactors methods lints other than the lints I refactored in https://github.com/rust-lang/rust-clippy/pull/6826 and moves some functions to methods/utils.rs.
Basically, I follow the instruction described in #6680.
**For ease of review, I refactored step by step, keeping each commit small.**
closes https://github.com/rust-lang/rust-clippy/issues/6886
cc: `@phansch,` `@flip1995,` `@Y-Nak`
changelog: Move lints in methods module to their own modules and some function to methods/utils.rs.
Jamie Quigley [Mon, 22 Mar 2021 19:34:20 +0000 (19:34 +0000)]
Ignore str::len() in or_fun_call lint.
bors [Mon, 22 Mar 2021 12:58:47 +0000 (12:58 +0000)]
Auto merge of #6942 - mgacek8:issue_6815_search_is_none, r=llogiq
search_is_some: add checking for `is_none()`
fixes: #6815
changelog: search_is_some: add checking for `is_none()`.
To be honest I don't know what is the process of renaming the lints. Appreciate any feedback if that needs to be handled differently. Thanks!
Mateusz Gacek [Sat, 20 Mar 2021 13:30:45 +0000 (14:30 +0100)]
search_is_some: check also when search is none
bors [Sun, 21 Mar 2021 14:42:45 +0000 (14:42 +0000)]
Auto merge of #6945 - ThibsG:BadSuggestionGenericsForReassignDefault, r=Manishearth
Fix suggestion with generics for `field_reassign_with_default` lint
Fix bad suggestion where `::` is missing after type if generics are involved
Fixes #6944
changelog: none
ThibsG [Sun, 21 Mar 2021 08:50:35 +0000 (09:50 +0100)]
Fix suggestion with generics for `field_reassign_with_default` lint
bors [Sat, 20 Mar 2021 17:35:21 +0000 (17:35 +0000)]
Auto merge of #6941 - ThibsG:suggMatchSingleBinding, r=llogiq
Fix bad suggestion for `match_single_binding` lint
Fix a bad suggestion that needs curly braces when the target `match` is the body of an arm.
Fixes #6572
changelog: none
bors [Sat, 20 Mar 2021 17:20:34 +0000 (17:20 +0000)]
Auto merge of #6939 - ThibsG:suggNewWithoutDefault, r=llogiq
Fix bad suggestion for generics in `new_without_default` lint
Fixes bad suggestion where a type parameter was missing for `new_without_default` lint.
Fixes #6933
changelog: none
ThibsG [Sat, 20 Mar 2021 15:31:39 +0000 (16:31 +0100)]
Split `match_single_binding` tests in 2 files (too many lines for CI)
ThibsG [Sat, 20 Mar 2021 15:11:19 +0000 (16:11 +0100)]
Fix bad suggestion that needs curly braces for `match_single_binding` lint
ThibsG [Sat, 20 Mar 2021 09:24:10 +0000 (10:24 +0100)]
Fix bad suggestion for generics in `new_without_default` lint
bors [Sat, 20 Mar 2021 06:59:13 +0000 (06:59 +0000)]
Auto merge of #6924 - mgacek8:issue6727_copy_types, r=llogiq
wrong_self_convention: `to_` convention respects `Copy` types
fixes #6727
changelog: wrong_self_convention: `to_` convention respects `Copy` types
Mateusz Gacek [Thu, 18 Mar 2021 18:45:13 +0000 (19:45 +0100)]
wrong_self_convention: Enhance lint message
bors [Fri, 19 Mar 2021 09:55:30 +0000 (09:55 +0000)]
Auto merge of #6935 - matthiaskrgr:qmark_marco, r=flip1995
needless_question_mark: don't lint if Some(..) is inside a macro def and the ? is not.
The suggestion would fail to apply.
Fixes #6921
changelog: needless_question_mark: don't lint if Some(..) is inside a macro def and the ? is not.
Matthias Krüger [Thu, 18 Mar 2021 22:01:42 +0000 (23:01 +0100)]
needless_question_mark: don't lint if Some(..) is inside a macro def and the ? is not.
The suggestion would fail to apply.
Fixes #6921
changelog: needless_question_mark: don't lint if Some(..) is inside a macro def and the ? is not.
bors [Thu, 18 Mar 2021 15:55:06 +0000 (15:55 +0000)]
Auto merge of #6928 - mgacek8:issue6675_or_fun_call_unsafe_blocks, r=phansch
or_fun_call: trigger on unsafe blocks
fixes #6675
changelog: or_fun_call: trigger on unsafe blocks
bors [Thu, 18 Mar 2021 10:39:28 +0000 (10:39 +0000)]
Auto merge of #6863 - Jarcho:wild_enum_match, r=llogiq
`match_wildcard` improvements
fixes: #6604
fixes: #5733
fixes: #6862
#5733 is only fixed in the normal case, if different paths are used for the variants then the same problem will occur. It's cause by `def_path_str` returning an utterly useless result. I haven't dug into why yet.
For #6604 there should be some discussion before accepting this. It's easy enough to change the message rather than disable the lint for `Option` and `Result`.
changelog: Attempt to find a common path prefix for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm`
changelog: Don't lint op `Option` and `Result` for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm`
changelog: Consider `or` patterns and `Self` prefix for `match_wildcard_for_single_variants` and `wildcard_enum_match_arm`
Mateusz Gacek [Thu, 18 Mar 2021 09:27:55 +0000 (10:27 +0100)]
Adjust use_self uitest to proper self convention
Mateusz Gacek [Wed, 17 Mar 2021 19:29:31 +0000 (20:29 +0100)]
or_fun_call: trigger on unsafe blocks
Mateusz Gacek [Wed, 17 Mar 2021 14:52:14 +0000 (15:52 +0100)]
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
bors [Wed, 17 Mar 2021 17:47:59 +0000 (17:47 +0000)]
Auto merge of #6856 - Jarcho:manual_map_if_let, r=Manishearth
Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain
fixes: #6847
changelog: Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain
Jason Newcomb [Fri, 5 Mar 2021 20:57:37 +0000 (15:57 -0500)]
Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain
Jason Newcomb [Tue, 16 Mar 2021 16:56:08 +0000 (12:56 -0400)]
Fix message for `match_wildcard_for_single_variant`
Takayuki Maeda [Wed, 17 Mar 2021 16:23:37 +0000 (01:23 +0900)]
replace crate::methods::utils with super::utils
Takayuki Maeda [Wed, 17 Mar 2021 16:06:24 +0000 (01:06 +0900)]
remove the use of paths
Jason Newcomb [Mon, 8 Mar 2021 15:33:36 +0000 (10:33 -0500)]
Add test for `#[non_exhaustive]` enum in `match_wildcard_for_single-variant`
Jason Newcomb [Sun, 7 Mar 2021 00:25:09 +0000 (19:25 -0500)]
Improvements to `match_wildcard_for_single_variants` and `wildcard_enum_match_arm` lints
Don't lint on `Result` and `Option` types.
Considers `or` patterns.
Considers variants prefixed with `Self`
Suggestions will try to find a common prefix rather than just using the full path
Takayuki Maeda [Wed, 17 Mar 2021 05:45:20 +0000 (14:45 +0900)]
move get_hint_if_single_char_arg to methods/utils.rs
Takayuki Maeda [Wed, 17 Mar 2021 05:34:20 +0000 (14:34 +0900)]
move chars_last_cmp_with_unwrap to its own module
Takayuki Maeda [Wed, 17 Mar 2021 05:26:27 +0000 (14:26 +0900)]
extract conditions for single_char_pattern into its own module
Takayuki Maeda [Wed, 17 Mar 2021 05:14:06 +0000 (14:14 +0900)]
extract condition for into_iter_on_ref to its own module
Takayuki Maeda [Wed, 17 Mar 2021 04:22:25 +0000 (13:22 +0900)]
extract conditions for `from_iter_instead_of_collect` into its own module
Takayuki Maeda [Wed, 17 Mar 2021 03:34:37 +0000 (12:34 +0900)]
extract conditions into modules
Takayuki Maeda [Wed, 17 Mar 2021 03:33:09 +0000 (12:33 +0900)]
move single_char_add_str to its own module
Takayuki Maeda [Wed, 17 Mar 2021 02:18:02 +0000 (11:18 +0900)]
use clippy_utils::ty::is_type_diagnostic_item
Takayuki Maeda [Wed, 17 Mar 2021 02:15:25 +0000 (11:15 +0900)]
fmt
Takayuki Maeda [Sat, 13 Mar 2021 16:37:33 +0000 (01:37 +0900)]
remove unused arguments
Takayuki Maeda [Sat, 13 Mar 2021 16:18:04 +0000 (01:18 +0900)]
extract a condition into a function.
Takayuki Maeda [Sat, 13 Mar 2021 16:05:37 +0000 (01:05 +0900)]
remove a needless variable
Takayuki Maeda [Sat, 13 Mar 2021 09:16:38 +0000 (18:16 +0900)]
use derefs_to_slice in methods/utils.rs
Takayuki Maeda [Sat, 13 Mar 2021 09:13:31 +0000 (18:13 +0900)]
move derefs_to_slice to methods/utils.rs
Takayuki Maeda [Sat, 13 Mar 2021 08:36:04 +0000 (17:36 +0900)]
refactor string_extend_chars: return when obj type is not string
Takayuki Maeda [Sat, 13 Mar 2021 08:28:22 +0000 (17:28 +0900)]
move chars_cmp_with_unwrap, chars_last_cmp and chars_next_cmp_with_unwrap to their own modules
Takayuki Maeda [Sat, 13 Mar 2021 08:17:10 +0000 (17:17 +0900)]
move chars_cmp and chars_next_cmp to its own modules
bors [Wed, 17 Mar 2021 14:42:46 +0000 (14:42 +0000)]
Auto merge of #6918 - camsteffen:utils-re-export, r=flip1995
Don't re-export `clippy_utils::*`
changelog: none
This should wrap up the utils-related really big changes. I personally don't see any more sub-modules to be added to `clippy_utils`.
Cameron Steffen [Wed, 17 Mar 2021 14:31:20 +0000 (09:31 -0500)]
Add clippy_utils::paths imports
Cameron Steffen [Tue, 16 Mar 2021 16:06:34 +0000 (11:06 -0500)]
Don't re-export clippy_utils::*
bors [Wed, 17 Mar 2021 10:53:02 +0000 (10:53 +0000)]
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
bors [Wed, 17 Mar 2021 09:49:20 +0000 (09:49 +0000)]
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
bors [Wed, 17 Mar 2021 09:24:54 +0000 (09:24 +0000)]
Auto merge of #6888 - matthiaskrgr:rip_ra_setup, r=flip1995
docs: update RA setup documentation
Add documentation how to get rust-analyzer to like clippys `extern crate` rustc deps.
Fixes #6883
This initially removed `cargo-dev ra_setup` but it is still needed by folks who use intellij rust, so keeping that.
changelog: none
Philipp Krones [Wed, 17 Mar 2021 09:24:27 +0000 (10:24 +0100)]
Rename the last ra_setup mention to ide_setup
Matthias Krüger [Wed, 17 Mar 2021 09:12:20 +0000 (10:12 +0100)]
rename `cargo dev ra_setup` to `cargo dev ide_setup`
Matthias Krüger [Fri, 12 Mar 2021 00:26:13 +0000 (01:26 +0100)]
CONTRIBUTING: update section explaining how to get ra to work inside the clippy repo
bors [Wed, 17 Mar 2021 04:34:15 +0000 (04:34 +0000)]
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.
Jason Newcomb [Tue, 16 Mar 2021 16:06:41 +0000 (12:06 -0400)]
Remove SmallVec
Jason Newcomb [Mon, 1 Mar 2021 21:31:04 +0000 (16:31 -0500)]
Add suggestion to `write_literal` and `print_literal`
Don't lint on a mixture of raw and regular strings
Fix spans in format strings
Jason Newcomb [Mon, 1 Mar 2021 18:28:36 +0000 (13:28 -0500)]
More specific spans for `use_debug` lint
Jason Newcomb [Mon, 1 Mar 2021 18:14:52 +0000 (13:14 -0500)]
Keep track of spans in format strings
Yukio Tanaka [Tue, 16 Mar 2021 15:06:42 +0000 (00:06 +0900)]
Use in_constant instead of is_const
bors [Tue, 16 Mar 2021 13:56:13 +0000 (13:56 +0000)]
Auto merge of #6912 - flip1995:dep-cleanup, r=Manishearth
Get rid of some unused dependecies
changelog: none
flip1995 [Mon, 15 Mar 2021 18:20:01 +0000 (19:20 +0100)]
Get rid of some unused dependecies
Yukio Tanaka [Tue, 16 Mar 2021 10:56:47 +0000 (19:56 +0900)]
Fix typo
Yukio Tanaka [Tue, 16 Mar 2021 10:46:40 +0000 (19:46 +0900)]
Fix FP of `manual_unwrap_or` in const fn
bors [Tue, 16 Mar 2021 07:08:48 +0000 (07:08 +0000)]
Auto merge of #6915 - smoelius:docs-link, r=llogiq
Do not show docs link when lint doesn't start with "clippy::"
This small change ensures that if the diagnostic functions are called from outside of Clippy, a docs link is not displayed.
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: restrict docs links
bors [Tue, 16 Mar 2021 02:57:33 +0000 (02:57 +0000)]
Auto merge of #6889 - Y-Nak:refactor-unit-types, r=flip1995
Refactor unit types
Ref: #6724
r? `@flip1995`
Changes:
1. Extract `unit_types` from `types` group.
2. Move lints of `unit_types` to their own modules.
Notes:
Other lints of `unit_types` is still scattered around the `clippy_lints`, e.g. `result_unit_err` or `option_map_unit_fn`.
These should be addressed in another PR.
changelog: none
Yoshitomo Nakanishi [Tue, 16 Mar 2021 01:37:05 +0000 (10:37 +0900)]
Remove unit_types::utils::is_unit
Yoshitomo Nakanishi [Fri, 12 Mar 2021 03:47:21 +0000 (12:47 +0900)]
Move unit_arg to its own module
Yoshitomo Nakanishi [Fri, 12 Mar 2021 03:38:31 +0000 (12:38 +0900)]
Move unit_cmp to its own module
Yoshitomo Nakanishi [Fri, 12 Mar 2021 03:28:31 +0000 (12:28 +0900)]
Move let_unit_value to its own module
Yoshitomo Nakanishi [Fri, 12 Mar 2021 03:15:45 +0000 (12:15 +0900)]
Extract utility functions to utils.rs
Yoshitomo Nakanishi [Fri, 12 Mar 2021 03:04:44 +0000 (12:04 +0900)]
Extract lints of unit_types group from types group
bors [Tue, 16 Mar 2021 02:09:43 +0000 (02:09 +0000)]
Auto merge of #6916 - camsteffen:diagnostics-util, r=Manishearth
Don't re-export `clippy_utils::diagnostics::*`
changelog: none
Continues #6907
Cameron Steffen [Tue, 16 Mar 2021 00:55:45 +0000 (19:55 -0500)]
Don't re-export clippy_utils::diagnostics::*
bors [Tue, 16 Mar 2021 00:08:01 +0000 (00:08 +0000)]
Auto merge of #6914 - camsteffen:source-utils, r=Manishearth
Move some utils to `clippy_utils::source`
changelog: none
Continues #6907
bors [Mon, 15 Mar 2021 22:36:57 +0000 (22:36 +0000)]
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`.
bors [Mon, 15 Mar 2021 22:13:45 +0000 (22:13 +0000)]
Auto merge of #6907 - camsteffen:ty-utils, r=flip1995
Move some utils to `clippy_utils::ty`
changelog: none
`clippy_utils::*` has become a giant junk drawer. This is one step to clean it up a bit. One motivation is that I believe the long import statements cause more merge conflicts.
Cameron Steffen [Sun, 14 Mar 2021 23:17:44 +0000 (18:17 -0500)]
Move some utils to clippy_utils::source module
Cameron Steffen [Sat, 13 Mar 2021 23:01:03 +0000 (17:01 -0600)]
Move some utils to ty_utils
bors [Mon, 15 Mar 2021 15:56:56 +0000 (15:56 +0000)]
Auto merge of #6831 - camsteffen:suspicious-map, r=Y-Nak,flip1995
Fix suspicious_map false positives
changelog: Fix suspicious_map false positives
Fixes #5253
Replaces #5375
Cameron Steffen [Mon, 15 Mar 2021 13:51:23 +0000 (08:51 -0500)]
Improve `find_binding_init` docs
Samuel E. Moelius III [Mon, 15 Mar 2021 09:40:21 +0000 (05:40 -0400)]
Do not show docs link when lint doesn't start with "clippy::"
Ben Boeckel [Thu, 26 Mar 2020 01:13:24 +0000 (21:13 -0400)]
Fix suspicious_map false positives
bors [Sun, 14 Mar 2021 15:01:01 +0000 (15:01 +0000)]
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.
iobtl [Sun, 14 Mar 2021 00:09:08 +0000 (08:09 +0800)]
use lint_unnecessary_cast for literals, suggest `_` if not present
bors [Sat, 13 Mar 2021 15:54:54 +0000 (15:54 +0000)]
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`
bors [Sat, 13 Mar 2021 15:43:00 +0000 (15:43 +0000)]
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()`
bors [Sat, 13 Mar 2021 15:31:14 +0000 (15:31 +0000)]
Auto merge of #6865 - Jarcho:explicit_deref_methods, r=llogiq
`explicit_deref_methods` improvements
Breaking up #6837
changelog: `explicit_deref_methods` will lint chained `deref` calls and ufcs style calls
Jason Newcomb [Sat, 13 Mar 2021 13:27:42 +0000 (08:27 -0500)]
Properly lint macro arguments for `explicit_deref_methods`
Jason Newcomb [Sat, 13 Mar 2021 01:13:45 +0000 (20:13 -0500)]
Keep track of whether `deref` or `deref_mut` was called
Remove more unnecessary code
Jason Newcomb [Tue, 9 Mar 2021 15:37:15 +0000 (10:37 -0500)]
Remove unneeded code.
Jason Newcomb [Tue, 2 Mar 2021 18:32:56 +0000 (13:32 -0500)]
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
iobtl [Sat, 13 Mar 2021 08:54:59 +0000 (16:54 +0800)]
replace span_lint with span_lint_and_sugg along with error message
bors [Sat, 13 Mar 2021 04:52:40 +0000 (04:52 +0000)]
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`