]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoAuto merge of #9303 - Jarcho:ice_9297, r=Alexendoo
bors [Mon, 8 Aug 2022 11:36:27 +0000 (11:36 +0000)]
Auto merge of #9303 - Jarcho:ice_9297, r=Alexendoo

Fix ICE when reading literals with weird proc-macro spans

fixes #9297
changelog: Fix ICE when reading literals with weird proc-macro spans

23 months agoAuto merge of #8694 - Jarcho:check_proc_macro, r=xFrednet
bors [Mon, 8 Aug 2022 09:27:33 +0000 (09:27 +0000)]
Auto merge of #8694 - Jarcho:check_proc_macro, r=xFrednet

More proc-macro detection

fixes #6514
fixes #8683
fixes #6858
fixes #6594

This is a more general way of checking if an expression comes from a macro and could be trivially applied to other lints. Ideally this would be fixed in rustc's proc-macro api, but I don't see that happening any time soon.

changelog: FPs: [`unit_arg`] [`default_trait_access`] [`missing_docs_in_private_items`]: No longer trigger in code generated from proc-macros.

23 months agoAuto merge of #9302 - Jarcho:sig_drop_nursery, r=flip1995
bors [Mon, 8 Aug 2022 08:28:06 +0000 (08:28 +0000)]
Auto merge of #9302 - Jarcho:sig_drop_nursery, r=flip1995

Move `significant_drop_in_scrutinee` into `nursey`

The current suggestion of extending the lifetime of every sub-expression is not great and doesn't fix the error given in the lint's example, though it does make the potential deadlock easier to see, but it can also cause it's own issues by delaying the drop of the lock guard.

e.g.
```rust
match x.lock().foo {
    ..
}
// some stuff
let y = x.lock();
```
The suggestion would create a deadlock at the second `x.lock()` call.

This also lints even when a significant drop type isn't created as a temporary. (#9072)

I agree `@kpreid` (https://github.com/rust-lang/rust-clippy/issues/8987#issuecomment-1207464440) that this should be back-ported before the lint hits stable.

changelog: Move `significant_drop_in_scrutinee` into `nursey`

23 months agoFix ICE when reading literals with weird proc-macro spans
Jason Newcomb [Mon, 8 Aug 2022 02:22:17 +0000 (22:22 -0400)]
Fix ICE when reading literals with weird proc-macro spans

23 months agoSmall cleanup for `check_proc_macro.rs`
Jason Newcomb [Mon, 8 Aug 2022 01:44:32 +0000 (21:44 -0400)]
Small cleanup for `check_proc_macro.rs`

23 months agoAdd note to the docs on `is_from_proc_macro`
Jason Newcomb [Sun, 24 Apr 2022 14:04:33 +0000 (10:04 -0400)]
Add note to the docs on `is_from_proc_macro`

23 months agoDon't lint `default_trait_access` in proc-macro expansions
Jason Newcomb [Wed, 13 Apr 2022 14:13:39 +0000 (10:13 -0400)]
Don't lint `default_trait_access` in proc-macro expansions

23 months agoDon't lint `missing_docs_in_private_items` on proc-macro output
Jason Newcomb [Wed, 13 Apr 2022 13:23:12 +0000 (09:23 -0400)]
Don't lint `missing_docs_in_private_items` on proc-macro output

23 months agoUse new util function in `suspicious_else_formatting`
Jason Newcomb [Wed, 13 Apr 2022 05:13:47 +0000 (01:13 -0400)]
Use new util function in `suspicious_else_formatting`

23 months agoDon't lint `unit_arg` when expanded from a proc-macro
Jason Newcomb [Wed, 13 Apr 2022 04:36:13 +0000 (00:36 -0400)]
Don't lint `unit_arg` when expanded from a proc-macro

23 months agoMove `significant_drop_in_scrutinee` into `nursey`
Jason Newcomb [Mon, 8 Aug 2022 01:01:27 +0000 (21:01 -0400)]
Move `significant_drop_in_scrutinee` into `nursey`

23 months agoAuto merge of #9294 - alex-semenyuk:enable_def_id_nocore_on_windows, r=xFrednet
bors [Fri, 5 Aug 2022 21:08:19 +0000 (21:08 +0000)]
Auto merge of #9294 - alex-semenyuk:enable_def_id_nocore_on_windows, r=xFrednet

Enable test for def_id_nocore for windows

Verified that it actully works on windows
changelog: none

23 months agoEnable test for def_id_nocore for windows
alex-semenyuk [Fri, 5 Aug 2022 20:24:50 +0000 (23:24 +0300)]
Enable test for def_id_nocore for windows

23 months agoAuto merge of #9292 - alex-semenyuk:typos_fixed, r=Alexendoo
bors [Fri, 5 Aug 2022 09:19:07 +0000 (09:19 +0000)]
Auto merge of #9292 - alex-semenyuk:typos_fixed, r=Alexendoo

Fix some typos

changelog: none

23 months agoFix some typos
alex-semenyuk [Thu, 4 Aug 2022 21:59:21 +0000 (00:59 +0300)]
Fix some typos

23 months agoAuto merge of #9266 - alex-semenyuk:cast_abs_to_unsigned_paren_fix, r=Jarcho
bors [Thu, 4 Aug 2022 18:45:32 +0000 (18:45 +0000)]
Auto merge of #9266 - alex-semenyuk:cast_abs_to_unsigned_paren_fix, r=Jarcho

Fix cast_abs_to_unsigned with code in parens

Close #9185
changelog: none

23 months agoFix cast_abs_to_unsigned generates non-compiling code when original code is in parens
alex-semenyuk [Sat, 30 Jul 2022 14:21:37 +0000 (17:21 +0300)]
Fix cast_abs_to_unsigned generates non-compiling code when original code is in parens

23 months agoFix some typos
alex-semenyuk [Thu, 4 Aug 2022 16:53:07 +0000 (19:53 +0300)]
Fix some typos

23 months agoAuto merge of #9284 - lengyijun:typo, r=dswij
bors [Wed, 3 Aug 2022 10:33:45 +0000 (10:33 +0000)]
Auto merge of #9284 - lengyijun:typo, r=dswij

fix typo in tests/ui/redundant_allocation.rs

changelog: none

23 months agoAuto merge of #9282 - macovedj:clone-on-copy-try-precedence, r=flip1995
bors [Wed, 3 Aug 2022 07:37:43 +0000 (07:37 +0000)]
Auto merge of #9282 - macovedj:clone-on-copy-try-precedence, r=flip1995

add paren before '?' when suggesting deref for clone_on_copy

changelog: none

fixes #9277

23 months agofix typo in tests/ui/redundant_allocation.rs
lengyijun [Wed, 3 Aug 2022 03:56:59 +0000 (03:56 +0000)]
fix typo in tests/ui/redundant_allocation.rs

23 months agoclean up
Daniel Macovei [Tue, 2 Aug 2022 17:06:22 +0000 (12:06 -0500)]
clean up

23 months agoadd paren before '?' when suggesting deref
Daniel Macovei [Tue, 2 Aug 2022 15:39:35 +0000 (10:39 -0500)]
add paren before '?' when suggesting deref

23 months agoAuto merge of #9053 - AaronC81:fix-9052, r=flip1995
bors [Tue, 2 Aug 2022 12:39:37 +0000 (12:39 +0000)]
Auto merge of #9053 - AaronC81:fix-9052, r=flip1995

Fix suggestions for `async` closures in redundant_closure_call

Fixes #9052

changelog: Fix suggestions given by [`redundant_closure_call`] for async closures

23 months agoAuto merge of #9264 - guerinoni:instant-elapsed, r=Alexendoo
bors [Tue, 2 Aug 2022 11:16:47 +0000 (11:16 +0000)]
Auto merge of #9264 - guerinoni:instant-elapsed, r=Alexendoo

Add `elapsed_instant` lint

Closes #8603

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

---

changelog: [`elapsed_instant`]: Add lint

23 months agoAuto merge of #9279 - tabokie:weight-loss, r=flip1995
bors [Tue, 2 Aug 2022 10:33:19 +0000 (10:33 +0000)]
Auto merge of #9279 - tabokie:weight-loss, r=flip1995

chore: a few small improvements to code quality

Some improvements:
- Simplify implementation of `is_unit_type`
- Use slice matching to destruct `Call` or `MethodCall` whenever possible

changelog: none

r? `@flip1995`

23 months agouse slice match more often
tabokie [Tue, 2 Aug 2022 04:01:36 +0000 (12:01 +0800)]
use slice match more often

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agosimplify unit type check
tabokie [Tue, 2 Aug 2022 03:37:44 +0000 (11:37 +0800)]
simplify unit type check

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agoAuto merge of #9254 - alex-semenyuk:enable_empty_loop_no_std_on_windows, r=dswij
bors [Tue, 2 Aug 2022 06:44:03 +0000 (06:44 +0000)]
Auto merge of #9254 - alex-semenyuk:enable_empty_loop_no_std_on_windows, r=dswij

Enable test empty_loop_no_std on windows

Verified that it actully works on windows
changelog: none

23 months agoAdd `elapsed_instant` lint
Federico Guerinoni [Sat, 30 Jul 2022 12:33:10 +0000 (14:33 +0200)]
Add `elapsed_instant` lint

Closes #8603

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
23 months agoAuto merge of #9273 - tabokie:assert_ok_fp, r=flip1995
bors [Mon, 1 Aug 2022 12:16:45 +0000 (12:16 +0000)]
Auto merge of #9273 - tabokie:assert_ok_fp, r=flip1995

Move [`assertions_on_result_states`] to restriction

Close #9263

This lint causes regression on readability of code and log output. And printing runtime values is not particularly useful for majority of tests which should be reproducible.

changelog: Move [`assertions_on_result_states`] to restriction and don't lint it for unit type

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agodo not apply [`assertions_on_result_states`] to unwrap unit type
tabokie [Mon, 1 Aug 2022 05:30:43 +0000 (13:30 +0800)]
do not apply [`assertions_on_result_states`] to unwrap unit type

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agoAuto merge of #9270 - schubart:link_to_developer_guide, r=xFrednet
bors [Mon, 1 Aug 2022 08:11:50 +0000 (08:11 +0000)]
Auto merge of #9270 - schubart:link_to_developer_guide, r=xFrednet

Make it easier to find the developer guide

changelog: none

23 months agoMake it easier to find the developer guide
Michael Schubart [Sun, 31 Jul 2022 22:16:23 +0000 (23:16 +0100)]
Make it easier to find the developer guide

Adding the link that I wish had been there when I first looked for
this info.

23 months agomove [`assertions_on_result_states`] to restriction
tabokie [Mon, 1 Aug 2022 05:22:16 +0000 (13:22 +0800)]
move [`assertions_on_result_states`] to restriction

Signed-off-by: tabokie <xy.tao@outlook.com>
23 months agoAuto merge of #9223 - sgued:unwrap-expect-used, r=giraffate
bors [Mon, 1 Aug 2022 01:27:03 +0000 (01:27 +0000)]
Auto merge of #9223 - sgued:unwrap-expect-used, r=giraffate

unwrap_used: Don't recommend using `expect` when the `expect_used` lint is not allowed

Fixes #9222

```
changelog: [`unwrap_used`]: Don't recommend using `expect` when the `expect_used` lint is not allowed
```

23 months agoApply suggestions from code review
Sosthene [Sat, 30 Jul 2022 11:17:51 +0000 (13:17 +0200)]
Apply suggestions from code review

The expect_used lint is allow-by-default, so it would be better to show the case where this is enabled.

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
23 months agoAuto merge of #8974 - Metaswitch:remove-blacklist-terminology, r=Manishearth
bors [Fri, 29 Jul 2022 19:12:49 +0000 (19:12 +0000)]
Auto merge of #8974 - Metaswitch:remove-blacklist-terminology, r=Manishearth

Remove "blacklist" terminology

Picking up where https://github.com/rust-lang/rust-clippy/pull/5896 left off, this renames the `blacklisted_name` lint to `disallowed_names` (pluralised for compliance with naming conventions).  The old name is still available though is deprecated (both in the lint name, and in the TOML configuration file).

This has been proposed/requested a few times, most recently in https://github.com/rust-lang/rust-clippy/issues/7582 where `@xFrednet` suggested pinging the Clippy team when a PR was created hence...

cc: `@rust-lang/clippy`

changelog: [`disallowed_names`] lint replaces `blacklisted_name`

23 months agoAdd deprecation test for old configuration entry
Andy Caldwell [Thu, 9 Jun 2022 15:11:19 +0000 (16:11 +0100)]
Add deprecation test for old configuration entry

23 months agoChange lint name to plural
Andy Caldwell [Wed, 8 Jun 2022 19:08:37 +0000 (20:08 +0100)]
Change lint name to plural

23 months agoRename "blacklisted name" to "disallowed name" throughout
Andy Caldwell [Wed, 8 Jun 2022 15:20:30 +0000 (16:20 +0100)]
Rename "blacklisted name" to "disallowed name" throughout

23 months agoAuto merge of #9252 - Metaswitch:use-deprecated-config, r=Jarcho
bors [Fri, 29 Jul 2022 00:54:10 +0000 (00:54 +0000)]
Auto merge of #9252 - Metaswitch:use-deprecated-config, r=Jarcho

Read and use deprecated configuration (as well as emitting a warning)

Original change written by `@flip1995` I've simply rebased to master and fixed up the formatting/tests.  This change teaches the configuration parser which config key replaced a deprecated key and attempts to populate the latter from the former.  If both keys are provided this fails with a duplicate key error (rather than attempting to guess which the user intended).

Currently this on affects `cyclomatic-complexity-threshold` -> `cognitive-complexity-threshold` but will also be used in #8974 to handle `blacklisted-names` -> `disallowed-names`.

```
changelog: deprecated configuration keys are still applied as if they were provided as their non-deprecated name.
```

- [x] `cargo test` passes locally
- [x] Run `cargo dev fmt`

23 months agoHarden duplicates checking and add tests
Andy Caldwell [Thu, 28 Jul 2022 22:05:24 +0000 (23:05 +0100)]
Harden duplicates checking and add tests

23 months agoFix tests
Sosthène Guédon [Thu, 28 Jul 2022 20:27:50 +0000 (22:27 +0200)]
Fix tests

23 months agounwrap_used: Fix doc to not recommend expect when expect_used is not allowed
Sosthène Guédon [Thu, 28 Jul 2022 20:08:48 +0000 (22:08 +0200)]
unwrap_used: Fix doc to not recommend expect when expect_used is not allowed

23 months agoAuto merge of #9257 - flip1995:rustup, r=flip1995
bors [Thu, 28 Jul 2022 16:56:38 +0000 (16:56 +0000)]
Auto merge of #9257 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

23 months agoBump nightly version -> 2022-07-28
Philipp Krones [Thu, 28 Jul 2022 16:56:16 +0000 (18:56 +0200)]
Bump nightly version -> 2022-07-28

23 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 28 Jul 2022 16:47:48 +0000 (18:47 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

23 months agoEnable test empty_loop_no_std on windows
alex-semenyuk [Thu, 28 Jul 2022 07:57:01 +0000 (10:57 +0300)]
Enable test empty_loop_no_std on windows

23 months agoAuto merge of #9253 - Serial-ATA:fix-fmt-err, r=flip1995
bors [Thu, 28 Jul 2022 07:54:15 +0000 (07:54 +0000)]
Auto merge of #9253 - Serial-ATA:fix-fmt-err, r=flip1995

Tell the user how to revert `dev setup intellij`

changelog: none

23 months agoTell the user how to revert `dev setup intellij`
Serial [Thu, 28 Jul 2022 07:40:21 +0000 (03:40 -0400)]
Tell the user how to revert `dev setup intellij`

23 months agoAuto merge of #9182 - Serial-ATA:new_lint-type-flag, r=xFrednet
bors [Wed, 27 Jul 2022 22:17:29 +0000 (22:17 +0000)]
Auto merge of #9182 - Serial-ATA:new_lint-type-flag, r=xFrednet

Add `--type` flag to `dev new_lint`

changelog: none

This only works with directories, `--type={copies, doc, ...}` won't work. Should they be counted?

23 months agoDocument `--type` flag
Serial [Wed, 27 Jul 2022 00:23:50 +0000 (20:23 -0400)]
Document `--type` flag

23 months agoRead and use deprecated configuration (as well as emitting a warning)
Philipp Krones [Wed, 27 Jul 2022 16:18:20 +0000 (17:18 +0100)]
Read and use deprecated configuration (as well as emitting a warning)

Co-authored-by: Andy Caldwell <andycaldwell@microsoft.com>
23 months agoRollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
Guillaume Gomez [Wed, 27 Jul 2022 15:55:07 +0000 (17:55 +0200)]
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov

Clean up HIR-based lifetime resolution

Based on https://github.com/rust-lang/rust/pull/97313.

Fixes #98932.

r? `@petrochenkov`

23 months agolint: add bad opt access internal lint
David Wood [Mon, 25 Jul 2022 12:02:39 +0000 (13:02 +0100)]
lint: add bad opt access internal lint

Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.

A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoAuto merge of #9249 - JohnTitor:book-prefer-checkout-v3, r=flip1995
bors [Wed, 27 Jul 2022 08:20:55 +0000 (08:20 +0000)]
Auto merge of #9249 - JohnTitor:book-prefer-checkout-v3, r=flip1995

Use `action/checkout@v3` in the book

As this type of document is often copied/pasted, using a newer version of `actions/checkout` would be better.

changelog: none

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoUse `action/checkout@v3` in the book
Yuki Okushi [Wed, 27 Jul 2022 07:49:34 +0000 (16:49 +0900)]
Use `action/checkout@v3` in the book

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoImplicitly set `--type=cargo` when using `--category=cargo`
Serial [Tue, 26 Jul 2022 23:32:34 +0000 (19:32 -0400)]
Implicitly set `--type=cargo` when using `--category=cargo`

23 months agoGive the user more information during creation
Serial [Tue, 26 Jul 2022 23:18:10 +0000 (19:18 -0400)]
Give the user more information during creation

23 months agoClippy fallout.
Camille GILLOT [Mon, 13 Jun 2022 09:53:31 +0000 (11:53 +0200)]
Clippy fallout.

23 months agoReplace LifetimeRes::Anonymous by LifetimeRes::Infer.
Camille GILLOT [Mon, 13 Jun 2022 06:22:06 +0000 (08:22 +0200)]
Replace LifetimeRes::Anonymous by LifetimeRes::Infer.

23 months agoAdd `--type` flag to `dev new_lint`
Serial [Thu, 14 Jul 2022 19:58:38 +0000 (15:58 -0400)]
Add `--type` flag to `dev new_lint`

23 months agoAuto merge of #9241 - Jarcho:ice_9238, r=xFrednet
bors [Mon, 25 Jul 2022 22:14:55 +0000 (22:14 +0000)]
Auto merge of #9241 - Jarcho:ice_9238, r=xFrednet

Fix ICE in `miri_to_const`

fixes #9238
changelog: Fix ICE when using `#![feature(generic_const_exprs)]` in various lints

23 months agoAuto merge of #9130 - c410-f3r:arith, r=llogiq
bors [Mon, 25 Jul 2022 21:26:15 +0000 (21:26 +0000)]
Auto merge of #9130 - c410-f3r:arith, r=llogiq

Add `Arithmetic` lint

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

r? `@llogiq`

changelog: Add `Arithmetic` lint

23 months agoAuto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov
bors [Mon, 25 Jul 2022 20:02:55 +0000 (20:02 +0000)]
Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov

Resolve function lifetime elision on the AST

~Based on https://github.com/rust-lang/rust/pull/97720~

Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST.
This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`.

This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR.

r? `@petrochenkov`

2 years agoClippy fallout.
Camille GILLOT [Mon, 6 Jun 2022 18:26:41 +0000 (20:26 +0200)]
Clippy fallout.

2 years agoAuto merge of #9243 - Jarcho:std_core, r=Manishearth
bors [Mon, 25 Jul 2022 15:19:41 +0000 (15:19 +0000)]
Auto merge of #9243 - Jarcho:std_core, r=Manishearth

Don't lint `std_instead_of_core` on `std::env`

fixes #9239

This also reorders the execution of the lint to do as little as possible in the case where the path doesn't start with `std` or `alloc`.

changelog: [`std_instead_of_core`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_core): Don't lint on `use std::env`
changelog: [`std_instead_of_alloc`](https://rust-lang.github.io/rust-clippy/master/#std_instead_of_alloc): Don't lint `use std::vec` twice

2 years agoAuto merge of #9225 - tabokie:assert_ok, r=Jarcho
bors [Mon, 25 Jul 2022 15:00:27 +0000 (15:00 +0000)]
Auto merge of #9225 - tabokie:assert_ok, r=Jarcho

add `[assertions_on_result_states]` lint

Close #9162

changelog: add `[assertions_on_result_states]` lint

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAdd `[assertions_on_result_states]` lint
tabokie [Fri, 22 Jul 2022 05:17:10 +0000 (13:17 +0800)]
Add `[assertions_on_result_states]` lint

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAuto merge of #9246 - kyoto7250:reopen_issue_8493, r=Jarcho
bors [Mon, 25 Jul 2022 14:26:27 +0000 (14:26 +0000)]
Auto merge of #9246 - kyoto7250:reopen_issue_8493, r=Jarcho

check macro statements in `[non_copy_const]`

close #8493
close #9224

This PR fixes false positives in `[non_copy_const]`.

changelog: fix false positives in`[non_copy_const]`

---

r? `@Jarcho`

2 years agofixed tests to not use tokio
kyoto7250 [Mon, 25 Jul 2022 14:04:18 +0000 (23:04 +0900)]
fixed tests to not use tokio

2 years agocheck macro statements in non_copy_const.rs
kyoto7250 [Mon, 25 Jul 2022 12:41:12 +0000 (21:41 +0900)]
check macro statements in non_copy_const.rs

2 years agoAuto merge of #9245 - alex-semenyuk:enable_multiple_config_files_on_windows, r=Alexendoo
bors [Mon, 25 Jul 2022 12:24:41 +0000 (12:24 +0000)]
Auto merge of #9245 - alex-semenyuk:enable_multiple_config_files_on_windows, r=Alexendoo

Enable test multiple_config_files on windows

Verified that it actully works on windows
changelog: none

2 years agoEnable test multiple_config_files on windows
alex-semenyuk [Mon, 25 Jul 2022 10:57:26 +0000 (13:57 +0300)]
Enable test multiple_config_files on windows

2 years agoAuto merge of #9244 - Jarcho:ice-9242, r=flip1995
bors [Mon, 25 Jul 2022 08:12:15 +0000 (08:12 +0000)]
Auto merge of #9244 - Jarcho:ice-9242, r=flip1995

Fix ICE in `question_mark`

fixes #9242
changelog: [`question_mark`](https://rust-lang.github.io/rust-clippy/master/#question_mark): Fix ICE on zero field tuple structs

2 years agoImprove `[std|alloc]_instead_of_[alloc|core]` lints
Jason Newcomb [Mon, 25 Jul 2022 00:17:55 +0000 (20:17 -0400)]
Improve `[std|alloc]_instead_of_[alloc|core]` lints
* Don't call `TyCtxt::crate_name` unless necessary
* Don't lint on `use std::env`
* Only lint once on `use std::vec`

2 years agoFix ICE in `question_mark`
Jason Newcomb [Mon, 25 Jul 2022 03:12:29 +0000 (23:12 -0400)]
Fix ICE in `question_mark`

2 years agoFix ICE in `miri_to_const`
Jason Newcomb [Sun, 24 Jul 2022 22:23:33 +0000 (18:23 -0400)]
Fix ICE in `miri_to_const`

2 years agoAuto merge of #9237 - Alexendoo:useless-format-spans, r=Jarcho
bors [Sun, 24 Jul 2022 17:21:15 +0000 (17:21 +0000)]
Auto merge of #9237 - Alexendoo:useless-format-spans, r=Jarcho

Fix `useless_format` spans for `format!("{foo}")`

Fixes #9234

changelog: [`useless_format`]: Fix spans for `format!("{foo}")`

https://github.com/rust-lang/rust/pull/94030 made our workaround unneeded, but by coincidence our test still passed [because `Span::new()` swaps `hi` & `lo` if needed](https://github.com/rust-lang/rust/blob/c32dcbba187d1ee0dbe92dc152cb9c2f3f42900c/compiler/rustc_span/src/span_encoding.rs#L86-L88). So with a single character variable like `format!("{x}")` it still worked

2 years agoFix `useless_format` spans for `format!("{foo}")`
Alex Macleod [Sun, 24 Jul 2022 16:37:08 +0000 (16:37 +0000)]
Fix `useless_format` spans for `format!("{foo}")`

2 years agoAuto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq
bors [Sun, 24 Jul 2022 11:49:22 +0000 (11:49 +0000)]
Auto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq

Fix src link

changelog: none

2 years agoFix src link
alexey semenyuk [Sun, 24 Jul 2022 08:22:50 +0000 (11:22 +0300)]
Fix src link

2 years agoAuto merge of #9230 - RalfJung:fix-doc-lint-names, r=Alexendoo
bors [Sat, 23 Jul 2022 13:05:21 +0000 (13:05 +0000)]
Auto merge of #9230 - RalfJung:fix-doc-lint-names, r=Alexendoo

fix outdated lint names in docs

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

changelog: fix outdated lint names in "as_conversions" documentation

2 years agofix outdated lint names in docs
Ralf Jung [Sat, 23 Jul 2022 12:36:26 +0000 (08:36 -0400)]
fix outdated lint names in docs

2 years agoAuto merge of #9229 - FoseFx:case_sensitive_file_extension_comparisons_doc, r=dswij
bors [Sat, 23 Jul 2022 11:59:19 +0000 (11:59 +0000)]
Auto merge of #9229 - FoseFx:case_sensitive_file_extension_comparisons_doc, r=dswij

Update case_sensitive_file_extension_comparisons example

Closing #9220

changelog: [`case_sensitive_file_extension_comparisons`]: update example

2 years agoDo not resolve associated const when there is no provided value
Michael Goulet [Fri, 15 Jul 2022 05:37:32 +0000 (05:37 +0000)]
Do not resolve associated const when there is no provided value

2 years agounwrap_used: Fix help, "an `None`" -> "`None`"
Sosthène Guédon [Fri, 22 Jul 2022 17:14:31 +0000 (19:14 +0200)]
unwrap_used: Fix help, "an `None`" -> "`None`"

2 years agoupdate case_sensitive_file_extension_comparisons example
Max Baumann [Fri, 22 Jul 2022 14:39:45 +0000 (16:39 +0200)]
update case_sensitive_file_extension_comparisons example
The old example does not work in case the delimiter is not in the name

Co-authored-by: flip1995 <9744647+flip1995@users.noreply.github.com>
2 years agounwrap_used: Stop recommending using `expect` when the `expect_used` lint is not...
Sosthène Guédon [Thu, 21 Jul 2022 20:45:12 +0000 (22:45 +0200)]
unwrap_used: Stop recommending using `expect` when the `expect_used` lint is not allowed

2 years agoAuto merge of #9214 - Jarcho:assign_op_prim, r=Manishearth
bors [Thu, 21 Jul 2022 17:00:40 +0000 (17:00 +0000)]
Auto merge of #9214 - Jarcho:assign_op_prim, r=Manishearth

Check `assign_op_pattern` for conflicting borrows

fixes #9180

changelog: [`assign_op_pattern`](https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern): Don't lint when the suggestion would cause borrowck errors.

2 years agoAuto merge of #9215 - alex-semenyuk:enable_test_entrypoint_recursion, r=Jarcho
bors [Thu, 21 Jul 2022 15:45:50 +0000 (15:45 +0000)]
Auto merge of #9215 - alex-semenyuk:enable_test_entrypoint_recursion, r=Jarcho

Enable test for entrypoint_recursion for windows

Verified that this test actually works on windows
changelog: none

2 years agoAuto merge of #9216 - smoelius:master, r=flip1995
bors [Thu, 21 Jul 2022 07:58:27 +0000 (07:58 +0000)]
Auto merge of #9216 - smoelius:master, r=flip1995

Add `ui_cargo_toml_metadata` test

This PR adds a test to check the metadata of packages in the `ui_cargo` directory.

A recent change to Cargo causes it to warn when it finds multiple packages with the same name in a git dependency (the issue is described [here](https://github.com/rust-lang/cargo/issues/10752)).

Many (if  not all) Dylint libraries depend upon `clippy_utils`. As a result of the change, one now sees the following when building a Dylint library:
```
warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/pass_mod`
warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/fail_no_mod`
warning: skipping duplicate package `cargo_common_metadata` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_common_metadata/fail_publish_true`
warning: skipping duplicate package `fail-cargo` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/pass_cargo`
warning: skipping duplicate package `fail-clippy` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_clippy`
warning: skipping duplicate package `fail-both-same` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_both_same`
warning: skipping duplicate package `fail-file-attr` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_file_attr`
```
There appear to be two contributing factors:
- Some packages in `ui_cargo` could have a `publish = false` added to them.
- Some packages in `ui_cargo` seem to be inconsistently named.

The new test checks that each package in the `ui_cargo` directory has a name matching one of its parent directories, and `publish = false` in its metadata (with a few exceptions).

Note that the packages in `cargo_common_metadata` require special care because `publish` is the subject of some of the `cargo_common_metadata` tests.

Also note that this PR adds `walkdir` as a dev dependency to the `clippy` package. However, it was already a dependency of `clippy_dev` and `lintcheck`. So hopefully this is acceptable.

Our continued thanks for making `clippy_utils` available, BTW. :)

r? `@flip1995`

changelog: none

2 years agoAuto merge of #9217 - Serial-ATA:extra-newlines, r=giraffate
bors [Thu, 21 Jul 2022 06:04:43 +0000 (06:04 +0000)]
Auto merge of #9217 - Serial-ATA:extra-newlines, r=giraffate

Remove extra newlines in [`significant_drop_in_scrutinee`] docs

changelog: none

2 years agoRemove extra newlines in [`significant_drop_in_scrutinee`] docs
Serial [Thu, 21 Jul 2022 01:35:11 +0000 (21:35 -0400)]
Remove extra newlines in [`significant_drop_in_scrutinee`] docs

2 years agoEnable test for entrypoint_recursion for windows
alex-semenyuk [Wed, 20 Jul 2022 18:41:12 +0000 (21:41 +0300)]
Enable test for entrypoint_recursion for windows

2 years agoDon't lint `assign_op_pattern` when the suggestion would cause borrowck errors
Jason Newcomb [Wed, 20 Jul 2022 14:00:04 +0000 (10:00 -0400)]
Don't lint `assign_op_pattern` when the suggestion would cause borrowck errors

2 years agoRevert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
Oli Scherer [Wed, 20 Jul 2022 07:55:58 +0000 (07:55 +0000)]
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

2 years agoAuto merge of #9207 - Jarcho:todo_arm, r=giraffate
bors [Wed, 20 Jul 2022 01:38:00 +0000 (01:38 +0000)]
Auto merge of #9207 - Jarcho:todo_arm, r=giraffate

Check for `todo!` on every expression in `SpanlessEq`

fixes #9204
changelog: [`match_same_arms`](https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms): Don't lint on arms with `todo!`

2 years agoAuto merge of #9210 - evantypanski:issue9160, r=Manishearth
bors [Tue, 19 Jul 2022 21:16:34 +0000 (21:16 +0000)]
Auto merge of #9210 - evantypanski:issue9160, r=Manishearth

Fix suggestion causing error for [`needless_borrow`] function in field

Fixes #9160

changelog: [`needless_borrow`]: Fix suggestion removing parens from calling a field