Commit Graph

11495 Commits

Author SHA1 Message Date
Takayuki Maeda
b6a2757561 replace crate::methods::utils with super::utils 2021-03-18 01:23:37 +09:00
Takayuki Maeda
0edd5f881d remove the use of paths 2021-03-18 01:06:24 +09:00
Jason Newcomb
6cc9cac4bc
Add test for #[non_exhaustive] enum in match_wildcard_for_single-variant 2021-03-17 12:04:19 -04:00
Jason Newcomb
0b7ab90eca
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
2021-03-17 12:04:11 -04: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
bors
6595d5571b 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`.
2021-03-17 14:42:46 +00: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
a2ee8490f8 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
2021-03-17 09:24:54 +00:00
Philipp Krones
6546285959
Rename the last ra_setup mention to ide_setup 2021-03-17 10:24:27 +01:00
Matthias Krüger
a62e4263d5 rename cargo dev ra_setup to cargo dev ide_setup 2021-03-17 10:12:45 +01:00
Matthias Krüger
3d7a84c8bb CONTRIBUTING: update section explaining how to get ra to work inside the clippy repo 2021-03-17 10:08:44 +01:00
Yuki Okushi
5476382dda Rollup merge of #83092 - petrochenkov:qspan, r=estebank
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for https://github.com/rust-lang/rust/pull/82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ````@estebank````
2021-03-17 15:20:54 +09: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
bors
846d4f0613 Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis
2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled

This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled.
1. Matching is always considered a use of the place, even with `_` patterns
2. Compiler ICE when capturing fields in closures through `let` assignments

To do so, we

- Introduced new Fake Reads
- Delayed use of `Place` in favor of `PlaceBuilder`
- Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code

Closes rust-lang/project-rfc-2229/issues/27
Closes rust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`
2021-03-16 19:19:06 +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
bors
5b3e61d62f Auto merge of #6912 - flip1995:dep-cleanup, r=Manishearth
Get rid of some unused dependecies

changelog: none
2021-03-16 13:56:13 +00:00
flip1995
bdf2dceec1
Get rid of some unused dependecies 2021-03-16 14:51:57 +01:00
Yukio Tanaka
aa5f1f9078
Fix typo 2021-03-16 19:56:47 +09: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
bors
1a206fc4ab 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
2021-03-16 07:08:48 +00:00
bors
c701c301d4 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
2021-03-16 02:57:33 +00: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