Commit Graph

11388 Commits

Author SHA1 Message Date
flip1995
06940fdda8
Bump nightly version -> 2021-03-25 2021-03-25 18:38:52 +01:00
flip1995
1f5f184105
Merge remote-tracking branch 'upstream/master' into rustup 2021-03-25 18:38:13 +01:00
bors
981ffa7c14 Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint
2021-03-25 03:01:35 +00:00
Elliot Bobrow
e9ebc27525 check for .to_string().into_bytes() in string_lit_to_bytes
apply changes from review
2021-03-24 17:31:20 -07:00
bors
4a1825a609 Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments
2021-03-24 21:09:01 +00:00
Jason Newcomb
6e88900f9e
Rename contains_adt to contains_adt_constructor 2021-03-24 16:23:02 -04:00
Jason Newcomb
99b8a67198
Fix false positive with new_ret_no_self when returning Self with different generic arguments 2021-03-24 16:22:28 -04:00
bors
917b538c68 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`
2021-03-24 18:42:20 +00:00
Takayuki Maeda
2f8d71b9dc merge imports 2021-03-25 00:17:43 +09:00
Takayuki Maeda
3b8e85a5dc fix false positive in manual_flatten 2021-03-25 00:15:21 +09:00
kadmin
e06731bb28 Add has_default to GenericParamDefKind::Const
This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs
2021-03-23 17:16:20 +00:00
bors
919a1a40fe Auto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995
Factor out `SpanlessEq::eq_ty_kind`

changelog: none
2021-03-23 16:25:28 +00:00
Cameron Steffen
9132dbdf31 Factor out eq_ty_kind 2021-03-23 10:49:12 -05:00
bors
b80903b727 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
2021-03-22 20:29:13 +00:00
bors
2bc180e888 Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177
2021-03-22 19:48:27 +00:00
bors
029777f029 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.
2021-03-22 19:36:22 +00:00
Jamie Quigley
45e775697e
Ignore str::len() in or_fun_call lint. 2021-03-22 19:34:20 +00:00
bors
aca95aac7b 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!
2021-03-22 12:58:47 +00:00
Mateusz Gacek
2ffee89b75 search_is_some: check also when search is none 2021-03-21 21:23:36 +01:00
bors
f3de78e0d6 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
2021-03-21 14:42:45 +00:00
ThibsG
3ddaabcbc9 Fix suggestion with generics for field_reassign_with_default lint 2021-03-21 09:58:04 +01:00
bors
0bdaa77d95 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
2021-03-20 17:35:21 +00:00
bors
478f2581b1 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
2021-03-20 17:20:34 +00:00
lcnr
731c98b16b update const_eval_resolve 2021-03-20 17:22:24 +01:00
ThibsG
7d45d8a29a Split match_single_binding tests in 2 files (too many lines for CI) 2021-03-20 16:31:39 +01:00
ThibsG
00a2d7ad7e Fix bad suggestion that needs curly braces for match_single_binding lint 2021-03-20 16:11:19 +01:00
ThibsG
296751f643 Fix bad suggestion for generics in new_without_default lint 2021-03-20 10:24:10 +01:00
bors
1d3c539fbb 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
2021-03-20 06:59:13 +00:00
mark
d2f0b27f0a clippy: stabilize or_patterns lint 2021-03-19 19:45:42 -05:00
Mateusz Gacek
1f2d01641d wrong_self_convention: Enhance lint message 2021-03-19 20:29:55 +01:00
bors
0d2e2b5f15 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.
2021-03-19 09:55:30 +00:00
Matthias Krüger
b42ec5e04d 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.
2021-03-18 23:47:21 +01:00
bors
36aee1c526 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
2021-03-18 15:55:06 +00:00
bors
4d686196b9 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`
2021-03-18 10:39:28 +00:00
Mateusz Gacek
032cdfe043 Adjust use_self uitest to proper self convention 2021-03-18 10:27:55 +01:00
Mateusz Gacek
b1f89ee02f or_fun_call: trigger on unsafe blocks 2021-03-18 08:44:15 +01:00
Vadim Petrochenkov
2c4570c958 hir: Preserve used syntax in TyKind::TraitObject 2021-03-18 03:02:32 +03: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
b62694b08f Auto merge of #82122 - bstrie:dep4real, r=dtolnay
Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated

Fixes #82080.

I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations).

As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.
2021-03-17 19:39:03 +00:00
bors
ba13311c46 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
2021-03-17 17:47:59 +00:00
Jason Newcomb
f468d82283
Fix manual_map suggestion for if let.. else ... if let.. else chain 2021-03-17 12:57:42 -04:00
bors
56138ad789 Auto merge of #83188 - petrochenkov:field, r=lcnr
ast/hir: Rename field-related structures

I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent.

- `StructField` -> `FieldDef` ("field definition")
- `Field` -> `ExprField` ("expression field", not "field expression")
- `FieldPat` -> `PatField` ("pattern field", not "field pattern")

Various visiting and other methods working with the fields are renamed correspondingly too.

The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
2021-03-17 16:49:46 +00:00
Jason Newcomb
d5a7941ead
Fix message for match_wildcard_for_single_variant 2021-03-17 12:42:18 -04:00
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