Commit Graph

14668 Commits

Author SHA1 Message Date
bors
a591e725a6 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
```
2022-08-01 01:27:03 +00:00
Sosthene
23b4fe6da5
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>
2022-07-30 13:17:51 +02:00
bors
a0ed68776e 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`
2022-07-29 19:12:49 +00:00
Andy Caldwell
56c9cc458d
Add deprecation test for old configuration entry 2022-07-29 19:39:20 +01:00
Andy Caldwell
66b46749e6
Change lint name to plural 2022-07-29 19:35:39 +01:00
Andy Caldwell
2f48257cfb
Rename "blacklisted name" to "disallowed name" throughout 2022-07-29 19:35:18 +01:00
bors
53a09d4855 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`
2022-07-29 00:54:10 +00:00
Andy Caldwell
ea25ef10cf
Harden duplicates checking and add tests 2022-07-28 23:05:24 +01:00
Sosthène Guédon
1fd9f2d271 Fix tests 2022-07-28 22:27:57 +02:00
Sosthène Guédon
307b800f27 unwrap_used: Fix doc to not recommend expect when expect_used is not allowed 2022-07-28 22:08:48 +02:00
bors
3c7e7dbc15 Auto merge of #9257 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-07-28 16:56:38 +00:00
Philipp Krones
510effce59
Bump nightly version -> 2022-07-28 2022-07-28 18:56:16 +02:00
Philipp Krones
0905ec465d
Merge remote-tracking branch 'upstream/master' into rustup 2022-07-28 18:55:32 +02:00
bors
70bca2988b Auto merge of #9253 - Serial-ATA:fix-fmt-err, r=flip1995
Tell the user how to revert `dev setup intellij`

changelog: none
2022-07-28 07:54:15 +00:00
Serial
1ed7bff32c Tell the user how to revert dev setup intellij 2022-07-28 03:40:21 -04:00
bors
cdd4dfc6d6 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?
2022-07-27 22:17:29 +00:00
Serial
8319196499 Document --type flag 2022-07-27 17:59:56 -04:00
Philipp Krones
08e7ec4047
Read and use deprecated configuration (as well as emitting a warning)
Co-authored-by: Andy Caldwell <andycaldwell@microsoft.com>
2022-07-27 17:47:20 +01:00
Guillaume Gomez
c31637e082 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`
2022-07-27 17:55:07 +02:00
David Wood
257259118c 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>
2022-07-27 11:24:27 +01:00
bors
d814681429 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>
2022-07-27 08:20:55 +00:00
Yuki Okushi
9164e3aa52
Use action/checkout@v3 in the book
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-27 16:49:34 +09:00
Serial
f31937043d Implicitly set --type=cargo when using --category=cargo 2022-07-26 19:32:34 -04:00
Serial
c8ee8c30f0 Give the user more information during creation 2022-07-26 19:18:10 -04:00
Camille GILLOT
8edcf6cd1e Clippy fallout. 2022-07-26 19:00:31 +02:00
Camille GILLOT
034b6f99ad Replace LifetimeRes::Anonymous by LifetimeRes::Infer. 2022-07-26 19:00:31 +02:00
Serial
51cd5a8667 Add --type flag to dev new_lint 2022-07-25 22:35:28 -04:00
bors
d72e5f2e10 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
2022-07-25 22:14:55 +00:00
bors
8882578a67 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
2022-07-25 21:26:15 +00:00
bors
6654aabb0f 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`
2022-07-25 20:02:55 +00:00
Camille GILLOT
419d39c072 Clippy fallout. 2022-07-25 19:19:23 +02:00
bors
c76db5c04e 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
2022-07-25 15:19:41 +00:00
bors
1cce0477e4 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>
2022-07-25 15:00:27 +00:00
tabokie
8454602cef Add [assertions_on_result_states] lint
Signed-off-by: tabokie <xy.tao@outlook.com>
2022-07-25 22:42:41 +08:00
bors
a14edd571e 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`
2022-07-25 14:26:27 +00:00
kyoto7250
b6c301055e fixed tests to not use tokio 2022-07-25 23:04:18 +09:00
kyoto7250
477356460b check macro statements in non_copy_const.rs 2022-07-25 22:28:49 +09:00
bors
f847795bb2 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
2022-07-25 12:24:41 +00:00
alex-semenyuk
b5e5b42815 Enable test multiple_config_files on windows 2022-07-25 13:57:26 +03:00
bors
af33de7d35 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
2022-07-25 08:12:15 +00:00
Jason Newcomb
6bc024df18 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`
2022-07-24 23:15:39 -04:00
Jason Newcomb
2255cfd2ab Fix ICE in question_mark 2022-07-24 23:12:29 -04:00
Jason Newcomb
ab6463e9d9 Fix ICE in miri_to_const 2022-07-24 18:23:33 -04:00
bors
20e4204730 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](c32dcbba18/compiler/rustc_span/src/span_encoding.rs (L86-L88)). So with a single character variable like `format!("{x}")` it still worked
2022-07-24 17:21:15 +00:00
Alex Macleod
d60d5e8bde Fix useless_format spans for format!("{foo}") 2022-07-24 16:47:17 +00:00
bors
4a5b7e266a Auto merge of #9235 - alex-semenyuk:fixing_guide_link, r=llogiq
Fix src link

changelog: none
2022-07-24 11:49:22 +00:00
alexey semenyuk
663cddc210
Fix src link 2022-07-24 11:22:50 +03:00
bors
580f642cfa 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
2022-07-23 13:05:21 +00:00
Ralf Jung
a7389556f8 fix outdated lint names in docs 2022-07-23 08:36:26 -04:00
bors
75dcbd5b92 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
2022-07-23 11:59:19 +00:00