Commit graph

13595 commits

Author SHA1 Message Date
Peter Jaszkowiak
c70f1e0f8f ignore &x | &y in unnested_or_patterns
replacing it with `&(x | y)` is actually more characters
2022-04-01 22:36:30 -06:00
bors
8ebe766695 Auto merge of #8582 - xFrednet:0000-changelog-1-60, r=Manishearth
Changelog for Rust 1.60.0 🦀 (Kudos to everyone who contributed!)

As always, I'm impressed by how much stuff happened in just one release. Seriously, kudos to everyone who contributed.

changelog: none
2022-03-25 17:05:05 +00:00
xFrednet
55feb4c4aa
Changelog for Rust 1.60.0 🦀 2022-03-25 17:58:39 +01:00
bors
d0cf3481a8 Auto merge of #8580 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

Nice small sync with only typo fixes

changelog: none
2022-03-24 13:29:13 +00:00
flip1995
c995a8b501
Bump nightly version -> 2022-03-24 2022-03-24 14:22:43 +01:00
flip1995
1147b2c481
Merge remote-tracking branch 'upstream/master' into rustup 2022-03-24 14:22:35 +01:00
bors
e29b3b55a4 Auto merge of #8579 - yoav-lavi:squashed-master, r=flip1995
`unnecessary_join` lint

changelog: Adds a lint called ``[`unnecessary_join`]`` that detects cases of `.collect::<Vec<String>>.join("")` or `.collect::<Vec<_>>.join("")` on an iterator, suggesting `.collect::<String>()` instead

Fixes: https://github.com/rust-lang/rust-clippy/issues/8570

This is a reopen of https://github.com/rust-lang/rust-clippy/pull/8573

changelog: add lint [`unnecessary_join`]
2022-03-24 12:57:08 +00:00
Yoav Lavi
b60a7fb7b6
unnecessary_join lint 2022-03-24 13:18:18 +01:00
bors
f07ee8a998 Auto merge of #8232 - Jarcho:match_same_arm_860, r=xFrednet
`match_same_arms` fix

fixes #860
fixes #1140

changelog: Don't lint `match_same_arms` when an interposing arm's pattern would overlap
2022-03-21 20:42:51 +00:00
bors
4a07662d94 Auto merge of #8561 - FoseFx:use_unwrap_or, r=xFrednet
add `or_then_unwrap`

Closes #8557

changelog: New lint [`or_then_unwrap`]
2022-03-21 20:08:29 +00:00
bors
ff0a3687d8 Auto merge of #8520 - J-ZhengLi:issue8506, r=xFrednet
fix suggestion on `[map_flatten]` being cropped causing possible information loss

fixes #8506

Multi-line suggestion given by the lint is missing its bottom part, which could potentially contains useful information about the fix.

---

changelog: [`map_flatten`]: Long suggestions will now be splitup into two help messages
2022-03-21 19:51:56 +00:00
J-ZhengLi
5b6295d663 allowing [map_flatten] to split long suggestions
add new function `span_lint_and_sugg_` for edges in `clippy_utils::diagnostics`
2022-03-21 14:11:22 +08:00
Max Baumann
765cce11b1
refactor: remove need for MethodCall matching 2022-03-21 00:04:37 +01:00
Max Baumann
4580c8a9b7
refactor: use is_lang_ctor() 2022-03-20 23:54:04 +01:00
Max Baumann
0f83753934
feat: change error message 2022-03-20 23:43:17 +01:00
bors
47b93ea5ef Auto merge of #8559 - pickfire:patch-1, r=xFrednet
Fix typo in bug report

repoduce -> reproduce

---

changelog: none
2022-03-20 22:32:12 +00:00
Max Baumann
20c352a4f6
test: add method chain test 2022-03-19 18:17:43 +01:00
Max Baumann
895de1f13e
feat: make fixable 2022-03-18 23:18:36 +01:00
Max Baumann
f00e844a1f
feat: use span_lint_and_sugg 2022-03-18 22:44:56 +01:00
Max Baumann
34ad33c57a
refactor: move into methods module 2022-03-18 21:11:54 +01:00
bors
a31dcb77be Auto merge of #8562 - Jarcho:enum_tuple_variant_as_int, r=Manishearth
Add lint `cast_enum_constructor`

fixes: #1116

changelog: Add lint `cast_enum_constructor`
2022-03-18 15:54:45 +00:00
Max Baumann
fd2c860171
feat: add comment 2022-03-18 14:45:48 +01:00
bors
9fd3c2d788 Auto merge of #8543 - dswij:8393, r=giraffate
`unnecessary_lazy_eval` show suggestions on multiline lint

Closes #8393

changelog: [`unnecessary_lazy_eval`] now shows suggestions for long-line lints
2022-03-18 00:42:18 +00:00
Max Baumann
3c4192f3e9
fix: ran update_lints 2022-03-18 01:12:39 +01:00
Max Baumann
05e05eaed7
refactor: rename lint to or_then_unwrap 2022-03-18 01:04:33 +01:00
Jason Newcomb
39329d1d40 Add lint cast_enum_constructor 2022-03-17 19:57:35 -04:00
Max Baumann
44c62c9aa2
feat: add tests and fix existing ones 2022-03-18 00:51:26 +01:00
Max Baumann
17ff85081d
feat: rename variable in example 2022-03-18 00:34:24 +01:00
Max Baumann
4493fc7d27
refactor: use pattern matching for MethodCall arguments
Co-authored-by: xFrednet <xFrednet@gmail.com>
2022-03-18 00:23:55 +01:00
Dylan DPC
1f069c0ce7 Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17 22:55:05 +01:00
Dylan DPC
59dd179ad3 Rollup merge of #94309 - eholk:issue-57017, r=tmandry
[generator_interior] Be more precise with scopes of borrowed places

Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as:

```rust
fn status(_client_status: &Client) -> i16 {
    200
}

fn main() {
    let client = Client;
    let g = move || match status(&client) {
        _status => yield,
    };
    assert_send(g);
}
```

In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`.

In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues.

Joint work with `@nikomatsakis`

Fixes #57017

r? `@tmandry`
2022-03-17 22:55:02 +01:00
Max Baumann
c22ff6cd6e
fix: fix clippy_lints 2022-03-17 19:52:07 +01:00
Max Baumann
747bb245e7
fix: fix broken dogfood tests 2022-03-17 19:29:59 +01:00
Max Baumann
3f00f074de
fix: fix tests 2022-03-17 19:13:44 +01:00
Max Baumann
f49a2c3457
feat: add use_unwrap_or 2022-03-17 18:57:28 +01:00
bors
8d5c0eadde Auto merge of #8552 - Jarcho:ptr_arg_8495, r=xFrednet
Don't lint `ptr_arg` on `&mut Cow<_>`

fixes: #8495

changelog: Don't lint `ptr_arg` on `&mut Cow<_>`
2022-03-17 17:05:26 +00:00
Ivan Tham
3ede557a62
Fix typo in bug report
repoduce -> reproduce
2022-03-17 22:53:27 +08:00
dswij
bd888d4354 Add some comments 2022-03-17 14:38:39 +08:00
Jason Newcomb
773d20341a Fix mixed enum variant kinds + code cleanup 2022-03-17 01:09:25 -04:00
bors
65e5cd0e95 Auto merge of #8553 - Jarcho:transmute_undefined_8499, r=llogiq
Don't lint `transmute_undefined_repr` when changing the type of generic params

Partially fixes #8499

changelog: Don't lint `transmute_undefined_repr` when changing the type of generic params
2022-03-16 19:27:44 +00:00
Jason Newcomb
08a7157a37 Improve message for match_single_arms 2022-03-16 13:58:09 -04:00
Jason Newcomb
4f8f4b4c82 Handle slice patterns in match_same_arms 2022-03-16 13:53:52 -04:00
Jason Newcomb
5508f461b8 Use DroplessArena when allocating ResolvedPats
Fix tuple handling in `match_same_arms`
2022-03-16 13:49:19 -04:00
Jason Newcomb
b37317b028 Check if there are any overlapping patterns between equal arm bodies in match_same_arm 2022-03-16 13:18:29 -04:00
Jason Newcomb
8e5208cbff Don't lint transmute_undefined_repr when changing the type of generic params 2022-03-16 12:56:23 -04:00
Jason Newcomb
851e715e5a Don't lint ptr_arg on &mut Cow<_> 2022-03-16 12:00:27 -04:00
codehorseman
4beda1be70 resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
bors
d23ddab82d Auto merge of #8544 - nellorocca:dev/5757, r=flip1995
Moved ``[try_err]`` to restriction

Fixes #5757

changelog: Moved try_err lint to rescrition for #5757
2022-03-16 09:55:39 +00:00
bors
2b0e730bf3 Auto merge of #8547 - Jarcho:transmute_8501, r=flip1995
More `transmute_undefined_repr` fixes

fixes: #8498
fixes: #8501
fixes: #8503

changelog: Allow `transumte_undefined_repr` between fat pointers and `(usize, usize)`
changelog: Allow `transumte_undefined_repr` when one side is a union
changelog: Fix `transumte_undefined_repr` on tuples with one non-zero-sized type.
2022-03-16 09:39:22 +00:00
bors
d6a3fbf8da Auto merge of #8546 - KisaragiEffective:patch-1, r=llogiq
[`collapsible_if`] fix typo in code-block kind specifier

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`collapsible_if`] fix typo in code-block kind specifier
2022-03-16 06:20:45 +00:00