]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate CHANGELOG.md
Manish Goregaokar [Fri, 17 Dec 2021 14:21:01 +0000 (19:51 +0530)]
Update CHANGELOG.md

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoUpdate CHANGELOG.md
Manish Goregaokar [Fri, 17 Dec 2021 14:20:53 +0000 (19:50 +0530)]
Update CHANGELOG.md

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoUpdate changelog
Manish Goregaokar [Fri, 17 Dec 2021 13:56:29 +0000 (19:26 +0530)]
Update changelog

2 years agoAuto merge of #8134 - flip1995:rustup, r=flip1995
bors [Fri, 17 Dec 2021 12:24:03 +0000 (12:24 +0000)]
Auto merge of #8134 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-12-17
flip1995 [Fri, 17 Dec 2021 12:22:34 +0000 (13:22 +0100)]
Bump nightly version -> 2021-12-17

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 17 Dec 2021 11:22:41 +0000 (12:22 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #7978 - smoelius:master, r=llogiq
bors [Wed, 15 Dec 2021 10:46:43 +0000 (10:46 +0000)]
Auto merge of #7978 - smoelius:master, r=llogiq

Add `unnecessary_to_owned` lint

This PR adds a lint to check for unnecessary calls to `ToOwned::to_owned` and other similar functions (e.g., `Cow::into_owned`, `ToString::to_string`, etc.).

The lint checks for expressions of the form `&receiver.to_owned_like()` used in a position requiring type `&T` where one of the following is true:
* `receiver`'s type is `T` exactly
* `receiver`'s type implements `Deref<Target = T>`
* `receiver`'s type implements `AsRef<T>`

The lint additionally checks for expressions of the form `receiver.to_owned_like()` used as arguments of type `impl AsRef<T>`.

It would be nice if the lint could also check for expressions used as arguments to functions like the following:
```
fn foo<T: AsRef<str>>(x: T) { ... }
```
However, I couldn't figure out how to determine whether a function input type was instantiated from a parameter with a trait bound.

If someone could offer me some guidance, I would be happy to add such functionality.

Closes #7933

changelog: Add [`unnecessary_to_owned`] lint

2 years agoExpand `is_clone_like` comment
Samuel E. Moelius III [Wed, 15 Dec 2021 10:25:47 +0000 (05:25 -0500)]
Expand `is_clone_like` comment

2 years agoRollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix
Matthias Krüger [Wed, 15 Dec 2021 07:36:19 +0000 (08:36 +0100)]
Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, r=jackh726,pnkfelix

Stabilize `destructuring_assignment`

Closes #71126

- [Stabilization report](https://github.com/rust-lang/rust/issues/71126#issuecomment-941148058)
- [Completed FCP](https://github.com/rust-lang/rust/issues/71126#issuecomment-954914819)

`@rustbot` label +F-destructuring-assignment +T-lang
Also needs +relnotes but I don't have permission to add that tag.

2 years agoStabilize `destructuring_assignment`
Jacob Pratt [Wed, 3 Nov 2021 06:50:57 +0000 (02:50 -0400)]
Stabilize `destructuring_assignment`

2 years agoRollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm
Matthias Krüger [Wed, 15 Dec 2021 00:28:08 +0000 (01:28 +0100)]
Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm

Stabilize `iter::zip`

Hello all!

As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue.

As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been
used in many places across the rust compiler and standard library since March without any issues.

For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).

2 years agoRollup merge of #90939 - estebank:wg-af-polish, r=tmandry
Matthias Krüger [Wed, 15 Dec 2021 00:28:04 +0000 (01:28 +0100)]
Rollup merge of #90939 - estebank:wg-af-polish, r=tmandry

Tweak errors coming from `for`-loop, `?` and `.await` desugaring

 * Suggest removal of `.await` on non-`Future` expression
 * Keep track of obligations introduced by desugaring
 * Remove span pointing at method for obligation errors coming from desugaring
 * Point at called local sync `fn` and suggest making it `async`

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:9:10
   |
LL |     boo().await;
   |     -----^^^^^^ `()` is not a future
   |     |
   |     this call returns `()`
   |
   = help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
   |
LL -     boo().await;
LL +     boo();
   |
help: alternatively, consider making `fn boo` asynchronous
   |
LL | async fn boo () {}
   | +++++
```

Fix #66731.

2 years agoAddress review comments
Samuel E. Moelius III [Tue, 14 Dec 2021 23:36:19 +0000 (18:36 -0500)]
Address review comments

2 years agoRemove iter::zip feature gate from clippy
PFPoitras [Tue, 14 Dec 2021 22:10:57 +0000 (18:10 -0400)]
Remove iter::zip feature gate from clippy

2 years agoAuto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
bors [Tue, 14 Dec 2021 21:15:22 +0000 (21:15 +0000)]
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett

Stabilize asm! and global_asm!

Tracking issue: #72016

It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/2850) was posted and we're finally ready to stabilize this feature!

The main changes in this PR are:
- Removing `asm!` and `global_asm!` from the prelude as per the decision in #87228.
- Stabilizing the `asm` and `global_asm` features.
- Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/1483).
  - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example.
- Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`.
- Updating `stdarch` and `compiler-builtins`.
- Updating all the tests.

r? `@joshtriplett`

2 years agoAdd comma
Samuel E. Moelius III [Mon, 13 Dec 2021 17:27:47 +0000 (12:27 -0500)]
Add comma

2 years agofix clippy tests
Esteban Kuber [Fri, 10 Dec 2021 17:20:57 +0000 (17:20 +0000)]
fix clippy tests

2 years agoFix rebase and clippy tests
Esteban Kuber [Tue, 16 Nov 2021 22:06:25 +0000 (22:06 +0000)]
Fix rebase and clippy tests

2 years agoFix clippy uses of QPath::LangItem
Esteban Kuber [Tue, 16 Nov 2021 20:44:25 +0000 (20:44 +0000)]
Fix clippy uses of QPath::LangItem

2 years agoHandle `to_vec` on for loop expression #8069
Samuel E. Moelius III [Mon, 13 Dec 2021 10:49:43 +0000 (05:49 -0500)]
Handle `to_vec` on for loop expression #8069

2 years agoAddress review comments
Samuel E. Moelius III [Tue, 30 Nov 2021 10:52:01 +0000 (05:52 -0500)]
Address review comments

* Share a list of methods with `implicit_clone`
* Ensure no overlap with `redundant_clone`

2 years agoAdd `unnecessary_to_owned` lint
Samuel E. Moelius III [Tue, 16 Nov 2021 00:25:08 +0000 (19:25 -0500)]
Add `unnecessary_to_owned` lint

2 years agoFix clippy tests
Amanieu d'Antras [Mon, 13 Dec 2021 00:00:51 +0000 (00:00 +0000)]
Fix clippy tests

2 years agoAuto merge of #91549 - fee1-dead:const_env, r=spastorino
bors [Sun, 12 Dec 2021 22:15:32 +0000 (22:15 +0000)]
Auto merge of #91549 - fee1-dead:const_env, r=spastorino

Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`

2 years agoclippy owo
Ellen [Sun, 12 Dec 2021 12:34:21 +0000 (12:34 +0000)]
clippy owo

2 years agoRevert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
Deadbeef [Sun, 12 Dec 2021 04:34:46 +0000 (12:34 +0800)]
Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"

This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing
changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.

2 years agoAuto merge of #8100 - c410-f3r:blah-blah-blah, r=giraffate
bors [Thu, 9 Dec 2021 23:50:02 +0000 (23:50 +0000)]
Auto merge of #8100 - c410-f3r:blah-blah-blah, r=giraffate

Fix `blocks_in_if_conditions` false positive

Fix #8099

changelog: Fix [`blocks_in_if_conditions`] false positive with an empty closure

2 years agoAuto merge of #8110 - xFrednet:0000-lintcheck-markdown-output, r=matthiaskrgr
bors [Thu, 9 Dec 2021 22:49:47 +0000 (22:49 +0000)]
Auto merge of #8110 - xFrednet:0000-lintcheck-markdown-output, r=matthiaskrgr

Update lintcheck output to use tables and add markdown support

This PR updates changes lintcheck's output to use text tables and adds a markdown option to use Markdown links in the reports table. At first, I tried to keep the original output format, but the loading of old stats broke with the markdown option. The old format is therefore sadly incompatible with the new one. I can if requested make it in a way that the markdown output is only and optional additional output, but that would require more work for little benefit IMO.

For now, lintcheck has two output types. Here are the examples (best viewed on desktop):

<details>
<summary>`cargo lintcheck --only anyhow`</summary>

```txt
clippy 0.1.59 (460bef22a 2021-12-08)

### Reports

target/lintcheck/sources/anyhow-1.0.38/build.rs:1:null clippy::cargo_common_metadata "package `anyhow` is missing `package.keywords` metadata"
target/lintcheck/sources/anyhow-1.0.38/src/error.rs:350:5 clippy::missing_panics_doc "docs for function which may panic missing `# Panics` section"
target/lintcheck/sources/anyhow-1.0.38/src/lib.rs:1:null clippy::cargo_common_metadata "package `anyhow` is missing `package.keywords` metadata"

### Stats:

| lint                                               | count |
| -------------------------------------------------- | ----- |
| clippy::missing_panics_doc                         |     1 |
| clippy::cargo_common_metadata                      |     2 |

### ICEs:

```

</details>

<details>
<summary>`cargo lintcheck --only anyhow --markdown` (The file links only work locally)</summary>

clippy 0.1.59 (460bef22a 2021-12-08)

### Reports

| file | lint | message |
| --- | --- | --- |
| [`anyhow-1.0.38/build.rs:1:null`](../target/lintcheck/sources/anyhow-1.0.38/build.rs#L1) | `clippy::cargo_common_metadata`                    | "package `anyhow` is missing `package.keywords` metadata" |
| [`anyhow-1.0.38/src/error.rs:350:5`](../target/lintcheck/sources/anyhow-1.0.38/src/error.rs#L350) | `clippy::missing_panics_doc`                       | "docs for function which may panic missing `# Panics` section" |
| [`anyhow-1.0.38/src/lib.rs:1:null`](../target/lintcheck/sources/anyhow-1.0.38/src/lib.rs#L1) | `clippy::cargo_common_metadata`                    | "package `anyhow` is missing `package.keywords` metadata" |

### Stats:

| lint                                               | count |
| -------------------------------------------------- | ----- |
| clippy::missing_panics_doc                         |     1 |
| clippy::cargo_common_metadata                      |     2 |

### ICEs:

</details>

The table margins are so large to keep the table inline for long file names and lint names

---

changelog: none

r? `@matthiaskrgr`

2 years agoUpdate lintcheck output to use tables and add markdown support
xFrednet [Thu, 9 Dec 2021 19:14:35 +0000 (20:14 +0100)]
Update lintcheck output to use tables and add markdown support

2 years agoAuto merge of #8096 - xFrednet:0000-remove-lintcheck-log-file, r=matthiaskrgr
bors [Thu, 9 Dec 2021 17:40:32 +0000 (17:40 +0000)]
Auto merge of #8096 - xFrednet:0000-remove-lintcheck-log-file, r=matthiaskrgr

Remove lintcheck log and add `--filter` option to lintcheck

This PR removes the really outdated lintcheck log from this repo and adds a new `--filter` option to force warnings of a lint. This also ignores `allow` attributes. I believe that this is a good thing, as we'll see if suppressed false positives are also fixed by the changes.

---

#### Example:
```sh
$ cargo lintcheck --filter identity_op
```

#### Output
```
clippy 0.1.59 (460bef22a 2021-12-08)

[..]/cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:1910:17 clippy::identity_op "the operation is ineffective. Consider reducing it to `(ret[0] as usize)`"
[..]/cargo-0.49.0/src/cargo/util/hex.rs:8:9 clippy::identity_op "the operation is ineffective. Consider reducing it to `num`"
[..]/libc-0.2.81/src/unix/linux_like/linux/mod.rs:2654:18 clippy::identity_op "the operation is ineffective. Consider reducing it to `(dev & 0x00000000000000ff)`"
[..]/libc-0.2.81/src/unix/linux_like/linux/mod.rs:2665:16 clippy::identity_op "the operation is ineffective. Consider reducing it to `(minor & 0x000000ff)`"
[..]/libc-0.2.81/src/unix/linux_like/mod.rs:1218:27 clippy::identity_op "the operation is ineffective. Consider reducing it to `IPOPT_CONTROL`"
[..]/rayon-1.5.0/src/slice/quicksort.rs:588:17 clippy::identity_op "the operation is ineffective. Consider reducing it to `len / 4`"
[..]/regex-1.3.2/src/dfa.rs:1380:14 clippy::identity_op "the operation is ineffective. Consider reducing it to `(empty_flags.start as u8)`"

Stats:
clippy::identity_op 7
ICEs:
```
Two of these lints are suppressed when lintcheck runs normally

---

changelog: none

r? `@matthiaskrgr` Feel free to reassign if you think that someone else would be a better reviewer :upside_down_face:

2 years agoAdd `filter` option to lintcheck
xFrednet [Wed, 8 Dec 2021 21:24:06 +0000 (22:24 +0100)]
Add `filter` option to lintcheck

2 years agoAuto merge of #8106 - medwards:rustc-lint-groups, r=flip1995
bors [Thu, 9 Dec 2021 13:36:51 +0000 (13:36 +0000)]
Auto merge of #8106 - medwards:rustc-lint-groups, r=flip1995

Remind users of separate `rustc` lint groups

changelog: none

fixes #8104

2 years agoRemind users of separate `rustc` lint groups
Michael Edwards [Thu, 9 Dec 2021 11:39:17 +0000 (12:39 +0100)]
Remind users of separate `rustc` lint groups

2 years agoFix `blocks_in_if_conditions` false positive
Caio [Wed, 8 Dec 2021 23:02:28 +0000 (20:02 -0300)]
Fix `blocks_in_if_conditions` false positive

2 years agoRemove and ignore lintcheck's log file
xFrednet [Sun, 28 Nov 2021 20:57:32 +0000 (21:57 +0100)]
Remove and ignore lintcheck's log file

2 years agoAuto merge of #8071 - GuillaumeGomez:method-must-use, r=xFrednet
bors [Wed, 8 Dec 2021 19:09:25 +0000 (19:09 +0000)]
Auto merge of #8071 - GuillaumeGomez:method-must-use, r=xFrednet

Add new lint to warn when #[must_use] attribute should be used on a method

This lint is somewhat similar to https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate but also different: it emits a warning by default and only targets methods (so not functions nor associated functions).

Someone suggested it to me after this tweet: https://twitter.com/m_ou_se/status/1466439813230477312

I think it would reduce the number of cases of API misuses quite a lot.

What do you think?

---

changelog: Added new [`return_self_not_must_use`] lint

2 years agoAuto merge of #8030 - WaffleLapkin:ignore_trait_assoc_types_type_complexity, r=llogiq
bors [Wed, 8 Dec 2021 11:54:03 +0000 (11:54 +0000)]
Auto merge of #8030 - WaffleLapkin:ignore_trait_assoc_types_type_complexity, r=llogiq

Ignore associated types in traits when considering type complexity

changelog: Ignore associated types in traits when checking ``[`type_complexity`]`` lint.

fixes #1013

2 years agoIgnore associated items in trait *implementations* when considering type complexity
Maybe Waffle [Wed, 8 Dec 2021 11:27:49 +0000 (14:27 +0300)]
Ignore associated items in trait *implementations* when considering type complexity

2 years agoApply new lint on clippy source code
Guillaume Gomez [Fri, 3 Dec 2021 17:00:41 +0000 (18:00 +0100)]
Apply new lint on clippy source code

2 years agoUpdate other UI tests as well
Guillaume Gomez [Fri, 3 Dec 2021 16:51:55 +0000 (17:51 +0100)]
Update other UI tests as well

2 years agoAdd new lint to warn when #[must_use] attribute should be used on a method
Guillaume Gomez [Fri, 3 Dec 2021 15:35:04 +0000 (16:35 +0100)]
Add new lint to warn when #[must_use] attribute should be used on a method

2 years agoAuto merge of #8086 - dswij:7991, r=giraffate
bors [Tue, 7 Dec 2021 23:45:58 +0000 (23:45 +0000)]
Auto merge of #8086 - dswij:7991, r=giraffate

Fix bad suggestion on `option_if_let_else` when there is complex subpat

closes #7991

Prefer not warning any complex subpat in `option_if_let_else` rather than suggesting obscure suggestions.

changelog: [`option_if_let_else`] does not warn when complex subpat is present

2 years agoAuto merge of #8075 - Qwaz:non_send_fields_documentation, r=xFrednet
bors [Tue, 7 Dec 2021 22:14:10 +0000 (22:14 +0000)]
Auto merge of #8075 - Qwaz:non_send_fields_documentation, r=xFrednet

Clarify the purpose of the non_send lint

PR 2/2 for issue #8045. Tried to tone down the warning message and clarify the intention of the lint. Specifically, I added a description that this lint tries to detect "types that are not safe to be sent to another thread".

changelog: none

r? `@xFrednet`

2 years agoMove `non_send_fields_in_send_ty` back to `nursery`
Yechan Bae [Tue, 7 Dec 2021 15:45:59 +0000 (10:45 -0500)]
Move `non_send_fields_in_send_ty` back to `nursery`

2 years agoFix grammar issues
Yechan Bae [Tue, 7 Dec 2021 15:02:58 +0000 (10:02 -0500)]
Fix grammar issues

2 years agoClarify the purpose of the lint
Yechan Bae [Sat, 4 Dec 2021 01:28:14 +0000 (20:28 -0500)]
Clarify the purpose of the lint

2 years ago`option_if_let_else` Do not warn when complex subpat is present
dswij [Tue, 7 Dec 2021 07:34:44 +0000 (15:34 +0800)]
`option_if_let_else` Do not warn when complex subpat is present

2 years agoAuto merge of #8085 - jqnatividad:8084-needless_lifetimes_typo, r=giraffate
bors [Tue, 7 Dec 2021 00:45:59 +0000 (00:45 +0000)]
Auto merge of #8085 - jqnatividad:8084-needless_lifetimes_typo, r=giraffate

`needless_lifetimes` Known problems typo

fixes #8084

[needless_lifetimes]

changelog: none

2 years ago`needless_lifetimes` Known problems typo
Joel Natividad [Tue, 7 Dec 2021 00:11:19 +0000 (19:11 -0500)]
`needless_lifetimes` Known problems typo

fixes #8084

2 years agoAuto merge of #8080 - dswij:8019, r=giraffate
bors [Tue, 7 Dec 2021 00:07:46 +0000 (00:07 +0000)]
Auto merge of #8080 - dswij:8019, r=giraffate

Fix FP on `question_mark` if returned object is not local

Closes #8019

changelog: [`question_mark`] Fix FP when returned object is not local

2 years agoAuto merge of #8042 - camsteffen:peel-blocks, r=xFrednet
bors [Mon, 6 Dec 2021 18:34:27 +0000 (18:34 +0000)]
Auto merge of #8042 - camsteffen:peel-blocks, r=xFrednet

Peel blocks and statements utils

changelog: none

* Rename `remove_blocks` to `peel_blocks`
* Add `peel_blocks_and_stmts`
* Various refactors to use the above utils
* The utils also now check `block.rules`

2 years agoSimplify needless_bool
Cameron Steffen [Thu, 25 Mar 2021 00:17:25 +0000 (19:17 -0500)]
Simplify needless_bool

2 years agoRefactors with peel_blocks
Cameron Steffen [Mon, 29 Nov 2021 14:34:36 +0000 (08:34 -0600)]
Refactors with peel_blocks

2 years agoRename remove_blocks to peel_blocks
Cameron Steffen [Thu, 1 Apr 2021 15:31:11 +0000 (10:31 -0500)]
Rename remove_blocks to peel_blocks

2 years agoAuto merge of #8066 - rust-lang:needless_bool_parenthesize, r=camsteffen
bors [Mon, 6 Dec 2021 15:15:26 +0000 (15:15 +0000)]
Auto merge of #8066 - rust-lang:needless_bool_parenthesize, r=camsteffen

Parenthesize blocks in `needless_bool` suggestion

Because the `if .. {}` statement already puts the condition in expression scope, contained blocks would be parsed as complete
statements, so any `&` binary expression whose left operand ended in a block would lead to a non-compiling suggestion.

We identify such expressions and add parentheses. Note that we don't make a difference between normal and unsafe blocks because the parsing problems are the same for both.

This fixes #8052.

---

changelog: none

2 years agoParenthesize blocks in `needless_bool` suggestion
Andre Bogus [Thu, 2 Dec 2021 21:47:57 +0000 (22:47 +0100)]
Parenthesize blocks in `needless_bool` suggestion

Because the `if .. {}` statement already puts the condition in
expression scope, contained blocks would be parsed as complete
statements, so any `&` binary expression whose left operand ended in a
block would lead to a non-compiling suggestion.

This adds a visitor to identify such expressions and add parentheses.

This fixes #8052.

2 years agoMerge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
flip1995 [Mon, 6 Dec 2021 11:33:31 +0000 (12:33 +0100)]
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup

2 years agoFix FP on `question_mark` if returned object is not local
dswij [Mon, 6 Dec 2021 09:18:17 +0000 (17:18 +0800)]
Fix FP on `question_mark` if returned object is not local

2 years agoAuto merge of #8077 - nixxquality:single_char_pattern-false-negatives, r=camsteffen
bors [Mon, 6 Dec 2021 05:12:12 +0000 (05:12 +0000)]
Auto merge of #8077 - nixxquality:single_char_pattern-false-negatives, r=camsteffen

Fix some false negatives for [`single_char_pattern`]

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

changelog: Fix some false negatives for [`single_char_pattern`]

I noticed that clippy wasn't complaining about my usage of `split_once("x")` in a personal project so I updated the list of functions.

I had to update the test case for an unrelated issue because replace is now included in the list of functions to be linted.

2 years agoFix dogfood
nixx quality [Sun, 5 Dec 2021 20:50:05 +0000 (21:50 +0100)]
Fix dogfood

2 years agoAuto merge of #8072 - xFrednet:0000-teach-rustbot-acronyms, r=llogiq
bors [Sun, 5 Dec 2021 17:33:25 +0000 (17:33 +0000)]
Auto merge of #8072 - xFrednet:0000-teach-rustbot-acronyms, r=llogiq

Enable rustbot shortcuts for rust-clippy

This enables shortcuts for ``@rustbot`.` Just a quality of life feature for contributors.

|Shortcut| Full comment |
|---|---|
| ``@rustbot` ready` | ``@rustbot` label -S-waiting-on-author +S-waiting-on-review` |
| ``@rustbot` author` | ``@rustbot` label +S-waiting-on-author -S-waiting-on-review` |

See: https://github.com/rust-lang/triagebot/wiki/Shortcuts

The documentation also states that the author/assignee will be pinged. However, this doesn't seem to be the case, it at least hasn't done so for me and in this [PR](https://github.com/rust-lang/rust/pull/90642#issuecomment-962465404)

---

changelog: none

2 years agofix some false negatives for single_char_pattern
nixx quality [Sun, 5 Dec 2021 16:33:52 +0000 (17:33 +0100)]
fix some false negatives for single_char_pattern

2 years agoUse IntoIterator for array impl everywhere.
Mara Bos [Fri, 3 Sep 2021 10:36:33 +0000 (12:36 +0200)]
Use IntoIterator for array impl everywhere.

2 years agoAuto merge of #8074 - Qwaz:send_nonnull, r=xFrednet
bors [Sat, 4 Dec 2021 17:19:07 +0000 (17:19 +0000)]
Auto merge of #8074 - Qwaz:send_nonnull, r=xFrednet

Consider NonNull as a pointer type

PR 1/2 for issue #8045. Add `NonNull` as a pointer class to suppress false positives like `UnsafeCell<NonNull<()>>`. However, this change is not sufficient to handle the cases shared in gtk-rs and Rug in the issue.

changelog: none

r? `@xFrednet`

2 years agoAuto merge of #8054 - camsteffen:map-flatten-style, r=giraffate
bors [Sat, 4 Dec 2021 13:30:09 +0000 (13:30 +0000)]
Auto merge of #8054 - camsteffen:map-flatten-style, r=giraffate

Upgrade map_flatten to complexity

changelog: upgrade [`map_flatten`] to complexity

Resolves #7999

2 years agoConsider NonNull as a pointer type
Yechan Bae [Sat, 4 Dec 2021 00:11:40 +0000 (19:11 -0500)]
Consider NonNull as a pointer type

2 years agoAdd initial AST and MIR support for unwinding from inline assembly
Amanieu d'Antras [Mon, 30 Aug 2021 00:23:33 +0000 (01:23 +0100)]
Add initial AST and MIR support for unwinding from inline assembly

2 years agoAuto merge of #8040 - xFrednet:6610-known-problems-section-for-pre-expansion, r=camst...
bors [Fri, 3 Dec 2021 19:31:33 +0000 (19:31 +0000)]
Auto merge of #8040 - xFrednet:6610-known-problems-section-for-pre-expansion, r=camsteffen

Updated known problems section for pre-expansion lints about level attributes

Our last three pre-macro expansion lints aren't affected by lint level attributes. This adds a comment to the know problems section of them. I've also updated some CSS to add some spacing after lists on Clippy's lint list:

Before:

![image](https://user-images.githubusercontent.com/17087237/143783579-064326d4-4e58-4d7d-bbe4-fad8b115fcd4.png)

After:

![image](https://user-images.githubusercontent.com/17087237/143783650-9803fa03-c332-4e0e-886f-523d4217c6e6.png)

---

changelog: [`print_stdout`], [`print_stderr`], [`dbg_macro`]: Document how the lint level can be changed and reference rust-lang/rust-clippy#6610

cc: rust-lang/rust-clippy#6610

2 years agoAdd margin after lists on Clippy's lint list
xFrednet [Fri, 3 Dec 2021 18:53:15 +0000 (19:53 +0100)]
Add margin after lists on Clippy's lint list

2 years agoUpgrade map_flatten to complexity
Cameron Steffen [Wed, 1 Dec 2021 14:38:54 +0000 (08:38 -0600)]
Upgrade map_flatten to complexity

2 years agoAdd note about crate lint level attributes to pre-expansion lints
xFrednet [Fri, 3 Dec 2021 18:29:57 +0000 (19:29 +0100)]
Add note about crate lint level attributes to pre-expansion lints

2 years agoEnable rustbot shortcuts for rust-clippy
xFrednet [Fri, 3 Dec 2021 18:10:14 +0000 (19:10 +0100)]
Enable rustbot shortcuts for rust-clippy

2 years agoRevert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
Santiago Pastorino [Fri, 3 Dec 2021 13:11:21 +0000 (10:11 -0300)]
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"

This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing
changes made to d9baa361902b172be716f96619b909f340802dea.

2 years agoAuto merge of #8061 - vallentin:fix-same-name-method-desc, r=flip1995
bors [Fri, 3 Dec 2021 00:37:52 +0000 (00:37 +0000)]
Auto merge of #8061 - vallentin:fix-same-name-method-desc, r=flip1995

Fixed same_name_method description

Noticed some odd phrasing, while checking out the new release.

changelog: none

2 years agoAuto merge of #8067 - frobiac:8060-backslash_escaped_in_single_char_pattern, r=giraffate
bors [Fri, 3 Dec 2021 00:23:59 +0000 (00:23 +0000)]
Auto merge of #8067 - frobiac:8060-backslash_escaped_in_single_char_pattern, r=giraffate

Escape backslash in single_char_pattern.rs

Escape backslash in single_char_pattern.

Previously, the proposed clippy fix for a single backslash in raw strings ```r"\"``` or ```r#"\"#``` was also only an unescaped, *single* ```'\'```:
```shell
warning: single-character string constant used as pattern
2 |     let s = r#"abc\xyz/"#.find(r"\");
  |                                ^^^^ help: try using a `char` instead: `'\'`
  |
  = note: `#[warn(clippy::single_char_pattern)]` on by default
```

This PR corrects this to a properly escaped *double* backslash ```'\\'```.
I haven't come up with any other problematic cases, a single quote was already handled.

Closes: #8060
changelog:  Escape backslash in ``[`single_char_pattern`]``

2 years agoEscape backslash for singe_char_pattern.rs
frobiac [Thu, 2 Dec 2021 22:47:23 +0000 (23:47 +0100)]
Escape backslash for singe_char_pattern.rs

2 years agoAuto merge of #7463 - ThibsG:find_any_7392, r=xFrednet
bors [Thu, 2 Dec 2021 17:27:54 +0000 (17:27 +0000)]
Auto merge of #7463 - ThibsG:find_any_7392, r=xFrednet

Fix `any()` not taking reference in `search_is_some` lint

`find` gives reference to the item, but `any` does not, so suggestion is broken in some specific cases.

Fixes: #7392
changelog: [`search_is_some`] Fix suggestion for `any()` not taking item by reference

2 years agoFixed same_name_method description
vallentin [Thu, 2 Dec 2021 17:07:28 +0000 (18:07 +0100)]
Fixed same_name_method description

2 years agoAuto merge of #91354 - fee1-dead:const_env, r=spastorino
bors [Thu, 2 Dec 2021 11:48:58 +0000 (11:48 +0000)]
Auto merge of #91354 - fee1-dead:const_env, r=spastorino

Cleanup: Eliminate ConstnessAnd

This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature.

We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`.

This is a continuation of https://github.com/rust-lang/rust/pull/90274.

r? `@oli-obk`

cc `@spastorino` `@ecstatic-morse`

2 years agoAuto merge of #8057 - flip1995:rustup, r=flip1995
bors [Thu, 2 Dec 2021 09:36:28 +0000 (09:36 +0000)]
Auto merge of #8057 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump Clippy Version -> 0.1.59
flip1995 [Thu, 2 Dec 2021 09:32:47 +0000 (09:32 +0000)]
Bump Clippy Version -> 0.1.59

2 years agoBump nightly version -> 2021-12-02
flip1995 [Thu, 2 Dec 2021 09:32:38 +0000 (09:32 +0000)]
Bump nightly version -> 2021-12-02

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 2 Dec 2021 09:32:09 +0000 (09:32 +0000)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #8049 - surechen:fixes_7946, r=flip1995
bors [Wed, 1 Dec 2021 09:58:54 +0000 (09:58 +0000)]
Auto merge of #8049 - surechen:fixes_7946, r=flip1995

Add test for pattern_type_mismatch.

This issue has been fixed by [commit](https://github.com/rust-lang/rust-clippy/commit/8c1c763c2d5897c66f52bd5e7c16f48ae66c894c)
This PR is used for close #7946(Fixes #7946).

changelog: Add test for pattern_type_mismatch.

2 years agoAuto merge of #7993 - homersimpsons:patch-1, r=flip1995
bors [Wed, 1 Dec 2021 09:44:24 +0000 (09:44 +0000)]
Auto merge of #7993 - homersimpsons:patch-1, r=flip1995

`no_std_swap`: Fix typo in TODO

changelog: none

2 years ago`no_std_swap`: Remove obsolete TODO from test
homersimpsons [Thu, 18 Nov 2021 10:54:35 +0000 (11:54 +0100)]
`no_std_swap`: Remove obsolete TODO from test

2 years agoAdd test for pattern_type_mismatch.
surechen [Tue, 23 Nov 2021 14:04:13 +0000 (22:04 +0800)]
Add test for pattern_type_mismatch.
This issue has been fixed by [commit](https://github.com/rust-lang/rust-clippy/commit/8c1c763c2d5897c66f52bd5e7c16f48ae66c894c)
This PR is used for close #7946(Fixes #7946).

changelog: Add test for pattern_type_mismatch.

2 years agoAuto merge of #8032 - flip1995:new_templates, r=camsteffen
bors [Tue, 30 Nov 2021 17:20:46 +0000 (17:20 +0000)]
Auto merge of #8032 - flip1995:new_templates, r=camsteffen

Use new template forms for issue templates

GitHub has a new way to define issue templates. This gives an even more consistent formatting of our issues.

You can find (read-only) rendered versions [here](https://github.com/flip1995/rust-clippy/tree/new_templates/.github/ISSUE_TEMPLATE). If you want to try to fill out this kind of issue, you can do this in the [`cargo` Repo](https://github.com/rust-lang/cargo/issues/new/choose).

changelog: Better issue templates

2 years agoUse new template forms for issue templates
flip1995 [Thu, 25 Nov 2021 15:01:41 +0000 (16:01 +0100)]
Use new template forms for issue templates

GitHub has a new way to define issue templates. This gives an even more
consistent formatting of our issues.

2 years agoFix tools
Deadbeef [Mon, 29 Nov 2021 12:42:16 +0000 (20:42 +0800)]
Fix tools

2 years agoAuto merge of #8001 - Jarcho:unprefixed_strlen, r=giraffate
bors [Mon, 29 Nov 2021 01:03:48 +0000 (01:03 +0000)]
Auto merge of #8001 - Jarcho:unprefixed_strlen, r=giraffate

Improve `strlen_on_c_string`

fixes: #7436

changelog: lint `strlen_on_c_string` when used without a fully-qualified path
changelog: suggest removing the surrounding unsafe block for `strlen_on_c_string` when possible

2 years agoAuto merge of #8006 - togami2864:generalize-copied, r=camsteffen
bors [Sun, 28 Nov 2021 20:59:20 +0000 (20:59 +0000)]
Auto merge of #8006 - togami2864:generalize-copied, r=camsteffen

apply iter_cloned_collect to collect() using copied()

fix: #6703

changelog: apply `iter_cloned_collect` to `collect()` using`copied()`

2 years agoTake a LocalDefId in expect_*item.
Camille GILLOT [Wed, 20 Oct 2021 20:38:10 +0000 (22:38 +0200)]
Take a LocalDefId in expect_*item.

2 years agoapply iter_cloned_collect to copied()
togami2864 [Sat, 20 Nov 2021 09:53:15 +0000 (18:53 +0900)]
apply iter_cloned_collect to copied()

2 years agoAdd a note about type annotation on closure param
ThibsG [Sun, 28 Nov 2021 08:50:34 +0000 (09:50 +0100)]
Add a note about type annotation on closure param

2 years agoRewrite comment when handling special case for `ProjectionKind::Deref`
ThibsG [Sat, 27 Nov 2021 19:32:23 +0000 (20:32 +0100)]
Rewrite comment when handling special case for `ProjectionKind::Deref`

2 years agoAdd `Index` when checking projs in a call, rename some variables and remove unneeded...
ThibsG [Sat, 27 Nov 2021 18:22:19 +0000 (19:22 +0100)]
Add `Index` when checking projs in a call, rename some variables and remove unneeded statements

2 years agoOnly check for errors in predicate when skipping impl assembly
Aaron Hill [Fri, 26 Nov 2021 15:14:16 +0000 (09:14 -0600)]
Only check for errors in predicate when skipping impl assembly

Prior to PR #91205, checking for errors in the overall obligation
would check checking the `ParamEnv`, due to an incorrect
`super_visit_with` impl. With this bug fixed, we will now
bail out of impl candidate assembly if the `ParamEnv` contains
any error types.

In practice, this appears to be overly conservative - when an error
occurs early in compilation, we end up giving up early for some
predicates that we could have successfully evaluated without overflow.
By only checking for errors in the predicate itself, we avoid causing
additional spurious 'type annotations needed' errors after a 'real'
error has already occurred.

With this PR, the diagnostic changes caused by PR #91205 are reverted.

2 years agoAuto merge of #7995 - Alexendoo:needless_late_init, r=giraffate
bors [Sat, 27 Nov 2021 14:24:02 +0000 (14:24 +0000)]
Auto merge of #7995 - Alexendoo:needless_late_init, r=giraffate

Add `needless_late_init` lint

examples:

```rust
let a;
a = 1;
// to
let a = 1;
```
```rust
let b;
match 3 {
    0 => b = "zero",
    1 => b = "one",
    _ => b = "many",
}
// to
let b = match 3 {
    0 => "zero",
    1 => "one",
    _ => "many",
};
```
```rust
let c;
if true {
    c = 1;
} else {
    c = -1;
}
// to
let c = if true {
    1
} else {
    -1
};
```

changelog: Add [`needless_late_init`]

2 years agoAdd async/const fn tests for needless-late-init
Alex Macleod [Fri, 26 Nov 2021 14:16:48 +0000 (14:16 +0000)]
Add async/const fn tests for needless-late-init

+nits