]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #7424 - dtolnay-contrib:macrobraces, r=llogiq
bors [Sat, 3 Jul 2021 10:14:01 +0000 (10:14 +0000)]
Auto merge of #7424 - dtolnay-contrib:macrobraces, r=llogiq

Downgrade nonstandard_macro_braces to nursery

Due to the large number of crates impacted by #7422, I don't think this lint can be enabled by default right now until the false positive is fixed.

---

changelog: remove [`nonstandard_macro_braces`] from default set of enabled lints

3 years agoDowngrade nonstandard_macro_braces to nursery
David Tolnay [Sat, 3 Jul 2021 05:14:32 +0000 (22:14 -0700)]
Downgrade nonstandard_macro_braces to nursery

3 years agoAuto merge of #7418 - flip1995:rustup, r=flip1995
bors [Thu, 1 Jul 2021 15:43:14 +0000 (15:43 +0000)]
Auto merge of #7418 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump nightly version -> 2021-07-01
flip1995 [Thu, 1 Jul 2021 15:41:34 +0000 (17:41 +0200)]
Bump nightly version -> 2021-07-01

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 1 Jul 2021 15:17:19 +0000 (17:17 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #7407 - m-ou-se:doc-hidden-variants, r=flip1995
bors [Thu, 1 Jul 2021 15:02:21 +0000 (15:02 +0000)]
Auto merge of #7407 - m-ou-se:doc-hidden-variants, r=flip1995

Don't suggest doc(hidden) or unstable variants in wildcard lint

Clippy's wildcard lint would suggest doc(hidden) and unstable variants for non_exhaustive enums, even though those aren't part of the public interface (yet) and should only be matched on using a `_`, just like potential future additions to the enum. There was already some logic to exclude a *single* doc(hidden) variant. This extends that to all hidden variants, and also hides `#[unstable]` variants.

See https://github.com/rust-lang/rust/pull/85746#issuecomment-868886893

This PR includes https://github.com/rust-lang/rust-clippy/pull/7406 as the first commit.

Here's the diff that this PR adds on top of that PR: https://github.com/m-ou-se/rust-clippy/compare/std-errorkind...m-ou-se:doc-hidden-variants

---

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

changelog: No longer suggest unstable and doc(hidden) variants in wildcard lint. wildcard_enum_match_arm, match_wildcard_for_single_variants

3 years agomatch_wildcard_for_single_variants: don't produce bad suggestion
flip1995 [Thu, 1 Jul 2021 10:35:16 +0000 (12:35 +0200)]
match_wildcard_for_single_variants: don't produce bad suggestion

This fixes a bug where match_wildcard_for_single_variants produced a
bad suggestion where besides the missing variant, one or more hidden
variants were left.

This also adds tests to the ui-tests match_wildcard_for_single_variants
and wildcard_enum_match_arm to make sure that the correct suggestion is
produced.

3 years agoSimplify wildcard_enum_match_arm test
flip1995 [Thu, 1 Jul 2021 09:47:56 +0000 (11:47 +0200)]
Simplify wildcard_enum_match_arm test

3 years agoAuto merge of #7400 - popzxc:restrict-locales, r=Manishearth
bors [Wed, 30 Jun 2021 18:14:16 +0000 (18:14 +0000)]
Auto merge of #7400 - popzxc:restrict-locales, r=Manishearth

New lint: `disallowed_script_idents`

This PR implements a new lint to restrict locales that can be used in the code,
as proposed in #7376.

Current concerns / unresolved questions:

- ~~Mixed usage of `script` (as a Unicode term) and `locale` (as something that is easier to understand for the broad audience). I'm not sure whether these terms are fully interchangeable and whether in the current form it is more confusing than helpful.~~ `script` is now used everywhere.
- ~~Having to mostly copy-paste `AllowedScript`. Probably it's not a big problem, as the list of scripts is standardized and is unlikely to change, and even if we'd stick to the `unicode_script::Script`, we'll still have to implement custom deserialization, and I don't think that it will be shorter in terms of the amount of LoC.~~ `unicode::Script` is used together with a filtering deserialize function.
- Should we stick to the list of "recommended scripts" from [UAX #31](http://www.unicode.org/reports/tr31/#Table_Recommended_Scripts) in the configuration?

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

changelog: ``[`disallowed_script_idents`]``

r? `@Manishearth`

3 years agoImplement 'disallowed_script_idents' lint
Igor Aleksanov [Wed, 30 Jun 2021 16:06:33 +0000 (19:06 +0300)]
Implement 'disallowed_script_idents' lint

3 years agoAuto merge of #7390 - popzxc:issue-7331, r=flip1995
bors [Wed, 30 Jun 2021 15:12:55 +0000 (15:12 +0000)]
Auto merge of #7390 - popzxc:issue-7331, r=flip1995

Improve lint message for match-same-arms lint

fixes #7331

Follow-up to #7377

This PR improves the lint message for `match-same-arms` lint and adds `todo!(..)`  example to the lint docs.

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

changelog: None

3 years agoAuto merge of #7411 - camsteffen:use-self-visitor, r=flip1995
bors [Tue, 29 Jun 2021 13:23:04 +0000 (13:23 +0000)]
Auto merge of #7411 - camsteffen:use-self-visitor, r=flip1995

Simplify use_self impl

changelog: none

Mainly to remove an extra visit and simplify the "in body?" logic.

3 years agoRemove a visitor from use_self
Cameron Steffen [Wed, 16 Jun 2021 17:14:23 +0000 (12:14 -0500)]
Remove a visitor from use_self

3 years agoUse type_of for impl self type
Cameron Steffen [Wed, 16 Jun 2021 20:43:48 +0000 (15:43 -0500)]
Use type_of for impl self type

3 years agoSimplify in impl check
Cameron Steffen [Wed, 16 Jun 2021 17:23:09 +0000 (12:23 -0500)]
Simplify in impl check

3 years agoMake ItemKind check dry
Cameron Steffen [Thu, 17 Jun 2021 16:19:33 +0000 (11:19 -0500)]
Make ItemKind check dry

3 years agoAuto merge of #7405 - jyn514:fix-stable, r=camsteffen
bors [Tue, 29 Jun 2021 13:03:45 +0000 (13:03 +0000)]
Auto merge of #7405 - jyn514:fix-stable, r=camsteffen

Stabilize `cargo clippy --fix`

This has been unstable since it was first introduced in
https://github.com/rust-lang/rust-clippy/pull/5363. In that time, I have
been using it successfully in nightly without issues. I don't think
there are any blocking issues now that RUSTC_WORKSPACE_WRAPPER is
stabilized, so this can be stabilized.

changelog: Stabilize `cargo clippy --fix`

3 years agoAuto merge of #7409 - xFrednet:5394-vs-code-tasks, r=giraffate,flip1995
bors [Tue, 29 Jun 2021 08:53:59 +0000 (08:53 +0000)]
Auto merge of #7409 - xFrednet:5394-vs-code-tasks, r=giraffate,flip1995

Added `cargo dev setup vscode-tasks` for simplicity

This PR adds a setup command to `clippy dev` that installs tasks into the Clippy vscode workspace. These might be useful as they be used via shortcuts and are accessible over the GUI. The available tasks are:
* `cargo check` (standard Linux shortcut `[ctrl] + [shift] + b`)
* `cargo dev fmt`
* `cargo uitest` (with a comment how to add the `TESTNAME` environment value)
* `cargo test`
* `cargo dev bless`

---

changelog: none

only internal changes again. cc #5394

r? `@flip1995` This should be pretty much the same as the other `cargo dev setup` commands. Would you mind reviewing this? :upside_down_face:

3 years agoStabilize `cargo clippy --fix`
Joshua Nelson [Sat, 26 Jun 2021 01:41:56 +0000 (21:41 -0400)]
Stabilize `cargo clippy --fix`

This has been unstable since it was first introduced in
https://github.com/rust-lang/rust-clippy/pull/5363. In that time, I have
been using it successfully in nightly without issues. I don't think
there are any blocking issues now that RUSTC_WORKSPACE_WRAPPER is
stabilized, so this can be stabilized.

3 years agoUpdated `clippy_dev` ui message and vscode task name
xFrednet [Mon, 28 Jun 2021 18:40:09 +0000 (20:40 +0200)]
Updated `clippy_dev` ui message and vscode task name

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
3 years agoAuto merge of #7350 - camsteffen:suspicious, r=flip1995
bors [Mon, 28 Jun 2021 08:35:51 +0000 (08:35 +0000)]
Auto merge of #7350 - camsteffen:suspicious, r=flip1995

Add suspicious group

changelog: Introduce `clippy::suspicious` ðŸ¤” group and move several lints into the group

Closes #6366. CC #6626.

A number of lints are moved from each of `correctness`, `style` and `complexity` groups. Notably I didn't move `suspicious_splitn` since I think that is a `correctness` lint despite the name.

Lints moved to `clippy::suspicious`:
* `blanket_clippy_restriction_lints` (was `clippy::style`)
* `empty_loop` (was `clippy::style`)
* `eval_order_dependence` (was `clippy::complexity`)
* `float_equality_without_abs` (was `clippy::correctness`)
* `for_loops_over_fallibles` (was `clippy::correctness`)
* `misrefactored_assign_op` (was `clippy::complexity`)
* `mut_range_bound` (was `clippy::complexity`)
* `mutable_key_type` (was `clippy::correctness`)
* `suspicious_arithmetic_impl` (was `clippy::correctness`)
* `suspicious_assignment_formatting` (was `clippy::style`)
* `suspicious_else_formatting` (was `clippy::style`)
* `suspicious_map` (was `clippy::complexity`)
* `suspicious_op_assign_impl` (was `clippy::correctness`)
* `suspicious_unary_op_formatting` (was `clippy::style`)

3 years agoAdded `cargo dev setup vscode-tasks` for simplicity
xFrednet [Sun, 27 Jun 2021 14:59:17 +0000 (16:59 +0200)]
Added `cargo dev setup vscode-tasks` for simplicity

3 years agoDon't suggest unstable and doc(hidden) variants.
Mara Bos [Sat, 26 Jun 2021 13:22:15 +0000 (15:22 +0200)]
Don't suggest unstable and doc(hidden) variants.

3 years agoDon't use exact definition of std's ErrorKind in test.
Mara Bos [Sat, 26 Jun 2021 12:50:42 +0000 (14:50 +0200)]
Don't use exact definition of std's ErrorKind in test.

Every time we add something to this enum in std, this test breaks.

3 years agoAdd remark-gfm to workflow job
Cameron Steffen [Fri, 25 Jun 2021 15:24:44 +0000 (10:24 -0500)]
Add remark-gfm to workflow job

3 years agoMove some lints to suspicious
Cameron Steffen [Mon, 14 Jun 2021 19:09:17 +0000 (14:09 -0500)]
Move some lints to suspicious

3 years agoAdd suspicious group
Cameron Steffen [Mon, 14 Jun 2021 15:01:43 +0000 (10:01 -0500)]
Add suspicious group

3 years agoFix clippy test
Ryan Levick [Fri, 25 Jun 2021 13:29:14 +0000 (15:29 +0200)]
Fix clippy test

3 years agoAuto merge of #7379 - popzxc:issue-7305, r=flip1995
bors [Fri, 25 Jun 2021 10:12:05 +0000 (10:12 +0000)]
Auto merge of #7379 - popzxc:issue-7305, r=flip1995

Do not spawn blacklisted_name lint in test context

---

fixed #7305

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

changelog: `blacklisted_name` lint is not spawned in the test context anymore.

3 years agoDo not spawn blacklisted_name lint in test context
Igor Aleksanov [Sat, 19 Jun 2021 18:14:05 +0000 (21:14 +0300)]
Do not spawn blacklisted_name lint in test context

Fix detecting of the 'test' attribute

Update UI test to actually check that warning is not triggered in the test code

Fix approach for detecting the test module

Add nested test case

Remove code duplication by extracting 'is_test_module_or_function' into 'clippy_utils'

Cleanup the code

3 years agoImprove lint message for match-same-arms lint
Igor Aleksanov [Tue, 22 Jun 2021 12:34:46 +0000 (15:34 +0300)]
Improve lint message for match-same-arms lint

Simplify error message producing & remove extra example

3 years agoAuto merge of #7361 - xFrednet:5394-expand-setup-command, r=flip1995
bors [Fri, 25 Jun 2021 09:22:04 +0000 (09:22 +0000)]
Auto merge of #7361 - xFrednet:5394-expand-setup-command, r=flip1995

Added `cargo dev setup git-hook` and updated `cargo dev setup intellij` including a `remove` command

This PR enables our dev tool to install a git hook that formats the code before each commit and also runs `update_lints` to make sure that everything is registered correctly. The script is located at `util/etc/pre-commit.sh`. I found it reasonable to locate it in the `util` folder and decided to add a `etc` in correlation to the main rust repo and to bring a bit of structure into it.

* The hook can be installed via: `cargo dev setup git-hook`
* And removed via: `cargo dev remove git-hook`

cc: #5394

The refactoring of `src/ide_setup.rs` to `src/setup/intellij.rs` is an extra commit to simplify the review.

---

Changes:
* Added `cargo dev setup git-hook` for formatting before every commit
* Added `cargo dev remove git-hook` to remove the hook again
* Added `cargo dev remove intellij` to remove rustc source path dependencies
* Changed `cargo dev ide_setup` to `cargo dev setup intellij`

changelog: none

This is only an internal change and therefore not worth an entry in the general change log.

---

Tested on:
* [x] Linux (by `@xFrednet)`
* [ ] Windows (All used commands run inside the git bash, so it's very likely to work as well `@xFrednet)`
* [ ] macOS

3 years agoUpdated several clippy_dev messages and types (PR suggestions)
xFrednet [Wed, 23 Jun 2021 17:04:09 +0000 (19:04 +0200)]
Updated several clippy_dev messages and types (PR suggestions)

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoAdded `cargo dev remove intellij`
xFrednet [Tue, 22 Jun 2021 18:13:05 +0000 (20:13 +0200)]
Added `cargo dev remove intellij`

3 years agoUpdated `cargo dev setup intellij` for cleaner user messages
xFrednet [Mon, 21 Jun 2021 22:25:10 +0000 (00:25 +0200)]
Updated `cargo dev setup intellij` for cleaner user messages

3 years agoAdded the `cargo dev remove` command for convenience
xFrednet [Wed, 16 Jun 2021 16:59:28 +0000 (18:59 +0200)]
Added the `cargo dev remove` command for convenience

3 years agoPrint cargo dev help on missing arg and updated setup documentation
xFrednet [Tue, 15 Jun 2021 22:21:13 +0000 (00:21 +0200)]
Print cargo dev help on missing arg and updated setup documentation

3 years agoAdjust pre-commit script to readd files after formatting
xFrednet [Tue, 15 Jun 2021 22:04:50 +0000 (00:04 +0200)]
Adjust pre-commit script to readd files after formatting

3 years agoAdded `cargo dev setup git-hook`
xFrednet [Thu, 10 Jun 2021 23:05:51 +0000 (01:05 +0200)]
Added `cargo dev setup git-hook`

3 years agoMoved dev `ide_setup` to `setup/intellij.rs`
xFrednet [Thu, 10 Jun 2021 18:45:03 +0000 (20:45 +0200)]
Moved dev `ide_setup` to `setup/intellij.rs`

3 years agoAuto merge of #7300 - DevinR528:import-rename, r=camsteffen
bors [Thu, 24 Jun 2021 20:23:13 +0000 (20:23 +0000)]
Auto merge of #7300 - DevinR528:import-rename, r=camsteffen

Add import_rename lint, this adds a field on the Conf struct

fixes #7276

changelog: Add ``[`import_rename`]`` a lint that enforces import renaming defined in the config file.

3 years agoAdd import_rename lint, this adds a field on the Conf struct
Devin Ragotzy [Mon, 31 May 2021 18:15:17 +0000 (14:15 -0400)]
Add import_rename lint, this adds a field on the Conf struct

Rename lint and fix review issues

3 years agoAuto merge of #7396 - ranweiler:zero-offset, r=Manishearth
bors [Wed, 23 Jun 2021 22:22:39 +0000 (22:22 +0000)]
Auto merge of #7396 - ranweiler:zero-offset, r=Manishearth

Fix invocation of `zst_offset` lint

The `zst_offset` lint was broken by a refactoring regression in 21083875d211c29fcfa4a21fcd66d4601d2b618b. In the invocation of the `zst_offset` check [here](https://github.com/rust-lang/rust-clippy/commit/21083875d211c29fcfa4a21fcd66d4601d2b618b#diff-7f73f6fe28c04b654223c09c42fe02937d2351fc58a91d21ab812aaf6f9b185dR1927), we shadow the already-destructured receiver `recv`, and accidentally pass the first argument of the method as if it were the receiver.

This was not caught because the UI test expectation was never correct (a bad cast obscured the actual test result).

This PR:
- Fixes the existing test expectation
- Tests both `const` and `mut` raw pointers
- Passes the actual receiver to the lint's implementation

Fixes #7395.

changelog: Fix [`zst_offset`] invocation and test

3 years agoAuto merge of #7394 - ehuss:update-opener, r=ehuss
bors [Wed, 23 Jun 2021 18:49:31 +0000 (18:49 +0000)]
Auto merge of #7394 - ehuss:update-opener, r=ehuss

Update opener.

This updates the opener dependency, to try to reduce the duplicate dependencies in the rust-lang/rust repo.  The changelog is [here](https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md#050---2021-06-11), and I don't expect it to have much of a change to anyone.

changelog: none

3 years agoUpdate var name in test
Joe Ranweiler [Wed, 23 Jun 2021 02:02:34 +0000 (19:02 -0700)]
Update var name in test

3 years agoRemove shadowed receiver in check invocation
Joe Ranweiler [Wed, 23 Jun 2021 01:45:12 +0000 (18:45 -0700)]
Remove shadowed receiver in check invocation

3 years agoRemove bad cast in test, cover more cases
Joe Ranweiler [Wed, 23 Jun 2021 01:44:04 +0000 (18:44 -0700)]
Remove bad cast in test, cover more cases

3 years agoUpdate opener.
Eric Huss [Tue, 22 Jun 2021 23:22:16 +0000 (16:22 -0700)]
Update opener.

3 years agoAuto merge of #7357 - ebobrow:unbalanced-tick, r=xFrednet,flip1995
bors [Mon, 21 Jun 2021 17:15:12 +0000 (17:15 +0000)]
Auto merge of #7357 - ebobrow:unbalanced-tick, r=xFrednet,flip1995

check for unbalanced tick pairs in doc-markdown lint

fixes #6753

changelog: check for unbalanced tick pairs in doc-markdown lint

3 years agoAuto merge of #7386 - camsteffen:fmt-workaround, r=flip1995
bors [Mon, 21 Jun 2021 17:01:51 +0000 (17:01 +0000)]
Auto merge of #7386 - camsteffen:fmt-workaround, r=flip1995

Remove rustfmt bug workaround

The bug is reportedly fixed.

changelog: none

3 years agocheck for unbalanced tick pairs in doc-markdown
Elliot Bobrow [Mon, 14 Jun 2021 19:23:33 +0000 (12:23 -0700)]
check for unbalanced tick pairs in doc-markdown

3 years agoRemove rustfmt workaround
Cameron Steffen [Mon, 21 Jun 2021 15:50:36 +0000 (10:50 -0500)]
Remove rustfmt workaround

3 years agoRollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3
Yuki Okushi [Mon, 21 Jun 2021 15:00:38 +0000 (00:00 +0900)]
Rollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3

Spaces

3 years agoDelete spaces
Alexander Melentyev [Mon, 21 Jun 2021 09:11:37 +0000 (12:11 +0300)]
Delete spaces

3 years agoAuto merge of #7385 - xFrednet:0000-fix-broken-deploy, r=flip1995
bors [Mon, 21 Jun 2021 08:55:38 +0000 (08:55 +0000)]
Auto merge of #7385 - xFrednet:0000-fix-broken-deploy, r=flip1995

Fixed broken deploy script due to multiline configuration docs

The deploy script on master currently runs into an error (See [log](https://github.com/rust-lang/rust-clippy/runs/2865828873)) due to the new configuration documentation added in #7299. The current documentation collection for the configuration macro sadly doesn't support multiline doc comments. This will be changes in the future with the new metadata collector tracked in #7172 For now we have to use `<br>` inside doc comments to add paragraphs.

This PR restricts `define_Conf!` macro to single lines and adds a comment explaining the reasoning behind it. It also adjusted the actual document parsing to fix a bug. (The parsing was automatically stopping on the first curly bracket, even if it was part of a doc comment).

changelog: none

3 years agoAuto merge of #7382 - matthiaskrgr:config_name, r=flip1995
bors [Mon, 21 Jun 2021 08:41:25 +0000 (08:41 +0000)]
Auto merge of #7382 - matthiaskrgr:config_name, r=flip1995

Fix wrong config option being suggested for deprecated wrong_pub_self_convention lint

Problem:
for code like
````rust
#![warn(clippy::wrong_pub_self_convention)]
fn main() {
    println!("Hello, world!");
}
````
clippy will issue a warning to use a clippy.toml option instead:

````
warning: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid_breaking_exported_api` config option to `false` to enable the `wrong_self_convention` lint for public items
 --> src/main.rs:2:9
  |
2 | #![warn(clippy::wrong_pub_self_convention)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default
````

But using the lint name as seen in the warning message
`echo "avoid_breaking_exported_api = true\n" > clippy.toml`

Will cause an error:
````
error: error reading Clippy's configuration file `/tmp/clippytest/clippy.toml`: unknown field `avoid_breaking_exported_api`, expected one of `avoid-breaking-exported-api`, ...
````

Replace the underscores with dashes in the deprecation message.

changelog: avoid_breaking_exported_api: suggest correct clippy config toml option in the deprecation message

3 years agoAuto merge of #7380 - popzxc:compile-test-helper, r=flip1995
bors [Mon, 21 Jun 2021 08:27:14 +0000 (08:27 +0000)]
Auto merge of #7380 - popzxc:compile-test-helper, r=flip1995

Improve panic message on "Found multiple rlibs" error in compile-test

Related to #7343

When I first met this error I was pretty much confused, so I thought it may be a good idea to:

- Give a hint on what to do to users that don't want to dig into specifics and just want to quickly resolve the issue.
- Give a link for those who are interested in details.

## Old appearance:

<img width="1121" alt="Screenshot 2021-06-20 at 08 30 34" src="https://user-images.githubusercontent.com/12111581/122663361-df8ae780-d1aa-11eb-9236-775b4fd754d5.png">

## New appearance:

<img width="1121" alt="Screenshot 2021-06-20 at 08 32 18" src="https://user-images.githubusercontent.com/12111581/122663363-e4e83200-d1aa-11eb-9c46-f62d83eb79e2.png">

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

changelog: none

3 years agoProvide different message for bootstrapped compiler
Igor Aleksanov [Mon, 21 Jun 2021 03:57:57 +0000 (06:57 +0300)]
Provide different message for bootstrapped compiler

3 years agoFixed broken deploy script due to multiline configuration docs
xFrednet [Sun, 20 Jun 2021 20:32:32 +0000 (22:32 +0200)]
Fixed broken deploy script due to multiline configuration docs

3 years agoAuto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
bors [Sun, 20 Jun 2021 20:07:13 +0000 (20:07 +0000)]
Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum

Replace some `std::iter::repeat` with `str::repeat`

I noticed that there were some instances where `std::iter::repeat` would be used to repeat a string or a char to take a specific count of it and then collect it into a `String` when `str::repeat` is actually much faster and better for that.

See also: https://github.com/rust-lang/rust-clippy/issues/7260.

3 years agoFix wrong config option being suggested for deprecated wrong_pub_self_convention...
Matthias Krüger [Sun, 20 Jun 2021 11:48:44 +0000 (13:48 +0200)]
Fix wrong config option being suggested for deprecated wrong_pub_self_convention lint

Problem:
for code like
````
fn main() {
    println!("Hello, world!");
}
````
clippy will issue a warning to use a clippy.toml option instead:

````
warning: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid_breaking_exported_api` config option to `false` to enable the `wrong_self_convention` lint for public items
 --> src/main.rs:2:9
  |
2 | #![warn(clippy::wrong_pub_self_convention)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default
````

But using the lint name as seen in the warning message
echo "avoid_breaking_exported_api = true\n" > clippy.toml

Will cause an error:
````
error: error reading Clippy's configuration file `/tmp/clippytest/clippy.toml`: unknown field `avoid_breaking_exported_api`, expected one of `avoid-breaking-exported-api`, ...
````

Replace the underscores with dashes in the deprecation message.

changelog: avoid_breaking_exported_api: suggest correct clippy config toml option in the deprecation message

3 years agoImprove appearance
Igor Aleksanov [Sun, 20 Jun 2021 05:32:43 +0000 (08:32 +0300)]
Improve appearance

3 years agoImprove visibility&helpfulness of the 'found multiple rlibs' error
Igor Aleksanov [Sun, 20 Jun 2021 05:25:30 +0000 (08:25 +0300)]
Improve visibility&helpfulness of the 'found multiple rlibs' error

3 years agoAuto merge of #7299 - DevinR528:macro-brace, r=llogiq
bors [Sat, 19 Jun 2021 17:56:56 +0000 (17:56 +0000)]
Auto merge of #7299 - DevinR528:macro-brace, r=llogiq

Add macro_braces lint to check for irregular brace use in certain macros

The name is a bit long but this sounds good as `#[allow(unconventional_macro_braces)]` and it seems more clear that we are talking about the macro call not macro definitions, any feedback let me know. Thanks!
fixes #7278

changelog: Add ``[`unconventional_macro_braces`]`` lint that checks for uncommon brace usage with macros.

3 years agoAuto merge of #86426 - hi-rustin:rustin-patch-lint-warn, r=Aaron1011
bors [Sat, 19 Jun 2021 08:41:58 +0000 (08:41 +0000)]
Auto merge of #86426 - hi-rustin:rustin-patch-lint-warn, r=Aaron1011

Lint for unused borrows as part of UNUSED_MUST_USE

close https://github.com/rust-lang/rust/issues/76264

base on https://github.com/rust-lang/rust/pull/76894

r? `@RalfJung`

3 years agoAuto merge of #7375 - djc:from-iter-pedantic, r=Manishearth
bors [Sat, 19 Jun 2021 08:01:58 +0000 (08:01 +0000)]
Auto merge of #7375 - djc:from-iter-pedantic, r=Manishearth

Move from-iter-instead-of-collect to pedantic

Since FromIterator will become part of the prelude, this lint being
warn by default is incongruous with the libs team position on the topic.

Fixes #7213.

---

changelog: moved [`from_iter_instead_of_collect`] to `pedantic` group

3 years agoMove from-iter-instead-of-collect to pedantic
Dirkjan Ochtman [Fri, 18 Jun 2021 20:18:16 +0000 (22:18 +0200)]
Move from-iter-instead-of-collect to pedantic

Since FromIterator will become part of the prelude, this lint being
warn by default is incongruous with the libs team position on the topic.

3 years agoAuto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper
bors [Fri, 18 Jun 2021 14:17:53 +0000 (14:17 +0000)]
Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper

Remove some last remants of {push,pop}_unsafe!

These macros have already been removed, but there was still some code handling these macros. That code is now removed.

3 years agoAddress comment
hi-rustin [Fri, 18 Jun 2021 08:20:30 +0000 (16:20 +0800)]
Address comment

3 years agoMake clippy tests happy
hi-rustin [Fri, 18 Jun 2021 08:11:32 +0000 (16:11 +0800)]
Make clippy tests happy

3 years agoAuto merge of #7371 - flip1995:changelog, r=flip1995
bors [Thu, 17 Jun 2021 19:09:12 +0000 (19:09 +0000)]
Auto merge of #7371 - flip1995:changelog, r=flip1995

Fix link in changelog

r? `@ghost`

changelog: none

3 years agoFix link in changelog
flip1995 [Thu, 17 Jun 2021 19:05:30 +0000 (21:05 +0200)]
Fix link in changelog

3 years agoAuto merge of #7366 - flip1995:changelog, r=Manishearth
bors [Thu, 17 Jun 2021 17:38:25 +0000 (17:38 +0000)]
Auto merge of #7366 - flip1995:changelog, r=Manishearth

Update changelog

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

Way fewer new lints than usual. Also now "Documentation" or "Others" updates this time.

changelog: none

3 years agoAuto merge of #7367 - flip1995:backport_remerge, r=flip1995
bors [Thu, 17 Jun 2021 16:07:48 +0000 (16:07 +0000)]
Auto merge of #7367 - flip1995:backport_remerge, r=flip1995

Remerge Beta backport changes

We do this to keep the Clippy commits that are in rust-lang/rust also in Clippy.

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 [Thu, 17 Jun 2021 16:04:58 +0000 (18:04 +0200)]
Merge remote-tracking branch 'upstream/beta' into backport_remerge

3 years agoUpdate changelog
flip1995 [Thu, 17 Jun 2021 15:59:08 +0000 (17:59 +0200)]
Update changelog

3 years agoAdd macro_braces lint to check for irregular brace use in certain macros
Devin Ragotzy [Sun, 30 May 2021 21:58:32 +0000 (17:58 -0400)]
Add macro_braces lint to check for irregular brace use in certain macros

Rename unconventional -> nonstandard, add config field

Add standard_macro_braces fields so users can specify macro names and
brace combinations to lint for in the clippy.toml file.

Fix errors caused by nonstandard_macro_braces in other lint tests

Fix users ability to override the default nonstandard macro braces

Add type position macros impl `check_ty`

3 years agoAuto merge of #7364 - flip1995:rustup, r=flip1995
bors [Thu, 17 Jun 2021 08:25:26 +0000 (08:25 +0000)]
Auto merge of #7364 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy version -> 0.1.55
flip1995 [Thu, 17 Jun 2021 08:23:08 +0000 (10:23 +0200)]
Bump Clippy version -> 0.1.55

3 years agoBump nightly version -> 2021-06-17
flip1995 [Thu, 17 Jun 2021 08:22:31 +0000 (10:22 +0200)]
Bump nightly version -> 2021-06-17

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 17 Jun 2021 08:21:47 +0000 (10:21 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #7352 - camsteffen:metadata-syntax, r=xFrednet
bors [Tue, 15 Jun 2021 21:44:00 +0000 (21:44 +0000)]
Auto merge of #7352 - camsteffen:metadata-syntax, r=xFrednet

Fix metadata code block syntax highlighting

changelog: none

Fixes code fence block in the metadata collector to change ` ``` ` or ` ```ignore` or ` ```rust,ignore` to ` ```rust`. This makes syntax highlighting work more consistently on the website.

3 years agoImprove metadata code block parsing
Cameron Steffen [Mon, 14 Jun 2021 19:10:19 +0000 (14:10 -0500)]
Improve metadata code block parsing

3 years agoAuto merge of #7355 - Pyther99:common-tools-link, r=camsteffen
bors [Tue, 15 Jun 2021 15:44:40 +0000 (15:44 +0000)]
Auto merge of #7355 - Pyther99:common-tools-link, r=camsteffen

Fix link in docs

The [docs](https://github.com/rust-lang/rust-clippy/blob/master/doc/common_tools_writing_lints.md) had an incorrect link for "Checking if a type defines a specific method".

changelog: none

3 years agoFix link
Pyther99 [Tue, 15 Jun 2021 15:38:16 +0000 (17:38 +0200)]
Fix link

3 years agoAuto merge of #7345 - DevinR528:disallowed-fix, r=Manishearth
bors [Mon, 14 Jun 2021 14:57:56 +0000 (14:57 +0000)]
Auto merge of #7345 - DevinR528:disallowed-fix, r=Manishearth

Remove requirement of fully qualified path for disallowed_method/type

changelog: Remove the need for fully qualified paths in disallowed_method and disallowed_type

After fixing this issue in [import_rename](https://github.com/rust-lang/rust-clippy/pull/7300#discussion_r650127720) I figured I'd fix it for these two.

If this does in fact fix the **Known problems:** section I was planning to remove them from both lints after confirmation.

3 years agoAuto merge of #7270 - Valentine-Mario:vec_extend_to_append, r=flip1995
bors [Mon, 14 Jun 2021 06:58:12 +0000 (06:58 +0000)]
Auto merge of #7270 - Valentine-Mario:vec_extend_to_append, r=flip1995

Vec extend to append

This PR adds a check to suggest changes of vector from

```
vec.extend(other_vec.drain(..))
```

could be written as

```
vec![].append(&mut vec![]);
```

changelog: Add vec_extend_to_append lint
issue: #7209

3 years agoAuto merge of #7288 - camsteffen:use-self2, r=phansch
bors [Mon, 14 Jun 2021 05:49:29 +0000 (05:49 +0000)]
Auto merge of #7288 - camsteffen:use-self2, r=phansch

Fix use_self FPs on type params

changelog: Fix [`use_self`] false positives on type parameters

Fixes #4140
Fixes #7139

3 years agofixup! Remove requirement of fully qualified path for disallowed_method/type
Devin Ragotzy [Sun, 13 Jun 2021 19:52:54 +0000 (15:52 -0400)]
fixup! Remove requirement of fully qualified path for disallowed_method/type

3 years agoRemove requirement of fully qualified path for disallowed_method/type
Devin Ragotzy [Fri, 11 Jun 2021 21:25:32 +0000 (17:25 -0400)]
Remove requirement of fully qualified path for disallowed_method/type

3 years agoAuto merge of #7160 - flip1995:field_reassign_macros, r=xFrednet,camsteffen
bors [Fri, 11 Jun 2021 15:58:58 +0000 (15:58 +0000)]
Auto merge of #7160 - flip1995:field_reassign_macros, r=xFrednet,camsteffen

Don't trigger `field_reassign_with_default` in macros

Fixes #7155

Producing a good suggestion for this lint is already hard when no macros
are involved. With macros the lint message and the suggestion are just
confusing. Since both, producing a good suggestion and figuring out if
this pattern can be re-written inside a macro is nearly impossible, just
bail out.

changelog: [`field_reassign_with_default`] No longer triggers in macros

---

No that our reviewing queue is under control, I want to start hacking on Clippy myself again. Starting with an easy issue to get back in :)

3 years agoAdd support for using qualified paths with structs in expression and pattern
Ryan Levick [Thu, 10 Dec 2020 12:20:07 +0000 (13:20 +0100)]
Add support for using qualified paths with structs in expression and pattern
position.

3 years agoadded lint to check for full range of vector and suggest append
valentine-mario [Thu, 10 Jun 2021 08:12:06 +0000 (09:12 +0100)]
added lint to check for full range of vector and suggest append

3 years agoAuto merge of #7333 - camsteffen:match-var, r=llogiq
bors [Thu, 10 Jun 2021 05:20:56 +0000 (05:20 +0000)]
Auto merge of #7333 - camsteffen:match-var, r=llogiq

Factor out match_var and get_pat_name utils

...because checking vars by name is bad, because of shadowing.

changelog: none

3 years agoAuto merge of #7332 - lengyijun:redundant_clone_fix, r=giraffate
bors [Thu, 10 Jun 2021 00:54:25 +0000 (00:54 +0000)]
Auto merge of #7332 - lengyijun:redundant_clone_fix, r=giraffate

redundant_clone: fix comment

changelog: none

3 years agoAuto merge of #7315 - DevinR528:disallowed-ty, r=giraffate
bors [Thu, 10 Jun 2021 00:30:36 +0000 (00:30 +0000)]
Auto merge of #7315 - DevinR528:disallowed-ty, r=giraffate

Add disallowed_type lint, this adds a field to the conf struct

Fixes #7277

changelog: Add ``[`disallowed_type`]`` a lint that can enforce banning types specified in the config.

3 years agoAuto merge of #86003 - pnkfelix:issue-84297-revert-81238, r=Mark-Simulacrum
bors [Wed, 9 Jun 2021 16:47:05 +0000 (16:47 +0000)]
Auto merge of #86003 - pnkfelix:issue-84297-revert-81238, r=Mark-Simulacrum

Make copy/copy_nonoverlapping fn's again

Make copy/copy_nonoverlapping fn's again, rather than intrinsics.

This a short-term change to address issue #84297.

It effectively reverts PRs #81167 #81238 (and part of #82967), #83091, and parts of #79684.

3 years agoAuto merge of #7334 - Thomasdezeeuw:freebsd-no-ticks, r=flip1995
bors [Wed, 9 Jun 2021 15:30:28 +0000 (15:30 +0000)]
Auto merge of #7334 - Thomasdezeeuw:freebsd-no-ticks, r=flip1995

Add FreeBSD as identifier not needing ticks

For the doc-markdown lint.

changelog: Add FreeBSD as identifier not needing ticks for ``[`doc-markdown`]`` lint.

3 years agoAdd FreeBSD as identifier not needing ticks
Thomas de Zeeuw [Wed, 9 Jun 2021 15:16:10 +0000 (17:16 +0200)]
Add FreeBSD as identifier not needing ticks

For the doc-markdown lint.

3 years agoFactor out match_var
Cameron Steffen [Wed, 9 Jun 2021 14:17:34 +0000 (09:17 -0500)]
Factor out match_var