Commit Graph

9005 Commits

Author SHA1 Message Date
Michael Goulet
27a476839f Rename some region-specific stuff 2023-02-16 03:39:59 +00:00
blyxyas
6ef34bf009
Remove commented code 2023-02-15 21:34:49 +01:00
blyxyas
4166b7dcfe
Fix lint message 2023-02-15 21:34:49 +01:00
blyxyas
6aa06b757d
Remove #[allow]s. Apply conversations from @Jarcho 2023-02-15 21:34:48 +01:00
blyxyas
8a2245dcb6
Change lint's from style to restriction 2023-02-15 21:34:48 +01:00
blyxyas
bdf4fd3e82
Tests pass 2023-02-15 21:34:48 +01:00
blyxyas
ade4c9b2b6
Rename lint to better fit lint naming conventions 2023-02-15 21:34:47 +01:00
Matthias Krüger
dd6534ae87 Rollup merge of #108047 - oli-obk:machine->🞋, r=RalfJung
Use `target` instead of `machine` for mir interpreter integer handling.

The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform. As per https://github.com/rust-lang/rust/pull/108029#issuecomment-1429791015

r? `@RalfJung`
2023-02-15 21:30:57 +01:00
blyxyas
8ec9543f13
Add impl_trait_param lint
As this is a lint about "style", and a purely cosmetical choice (using `<A: Trait>` over `impl Trait`), a lot of other files needed to be allowed this lint.
2023-02-15 21:29:58 +01:00
bors
30f38d69ab Auto merge of #108006 - cjgillot:def-impl, r=oli-obk
Avoid accessing HIR when it can be avoided

Experiment to see if it helps some incremental cases.

Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged.

r? `@ghost`
2023-02-15 16:14:10 +00:00
Michael Krasnitski
1ee4651ca1 Ignore synthetic type parameters for extra_unused_type_parameters 2023-02-15 10:01:33 -05:00
bors
595f783f22 Auto merge of #10321 - mkrasnitski:false-positives, r=flip1995
Fix false positives for `extra_unused_type_parameters`

Don't lint external macros. Also, if the function body is empty, any type parameters with bounds on them are not linted. Note that only the body needs be empty - this rule still applies if the function takes any arguments.

fixes #10318
fixes #10319
changelog: none
<!-- changelog_checked -->
2023-02-15 14:37:16 +00:00
bors
8754d5a6fb Auto merge of #10343 - samueltardieu:issue-10339, r=Alexendoo
uninlined_format_args: do not inline argument with generic parameters

Fix #10339

---

changelog: FP: [`uninlined_format_args`]: No longer lints for arguments with generic parameters
[#10343](https://github.com/rust-lang/rust-clippy/pull/10343)
<!-- changelog_checked -->
2023-02-15 13:35:49 +00:00
bors
d3d235dcbf Auto merge of #10345 - J-ZhengLi:issue_10049, r=xFrednet
fix [`needless_return`] incorrect suggestion when returning if sequence

fixes: #10049

---

changelog: [`needless_return`]: fix incorrect suggestion  on if sequence
2023-02-15 10:27:46 +00:00
Oli Scherer
cecc45cedc Use target instead of machine for mir interpreter integer handling.
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15 08:56:18 +00:00
Samuel Tardieu
75aa2b9ec8 uninlined_format_args: do not inline argument with generic parameters 2023-02-15 08:49:43 +01:00
bors
e018a2c8bd Auto merge of #10328 - compiler-errors:fix-re-erased-in-needless_pass_by_value, r=matthiaskrgr
Liberate late-bound regions rather than erasing them in `needless_pass_by_value`

changelog: [`needless_pass_by_value`]: fixes an ICE when there are late-bound regions in function arguments that are needlessly passed by value

Fixes rust-lang/rust#107147
r? `@matthiaskrgr`
2023-02-15 06:41:35 +00:00
J-ZhengLi
8b93eb8a9b add some adjustment regarding review suggestion 2023-02-15 11:26:30 +08:00
Samuel Tardieu
7f15a11aa1 manual_let_else: let/else is not divergent by default
The divergent `else` block of a `let`/`else` statement does not make
the `let`/`else` statement itself divergent.
2023-02-15 00:47:43 +01:00
Michael Goulet
17cb2e47e5 Liberate late-bound regions rather than erasing them in needless_pass_by_value 2023-02-14 23:27:46 +00:00
bors
0e40f94a86 Auto merge of #10346 - samueltardieu:issue-10331, r=Manishearth
Do not base map_entry lint suggestion on expanded code

Fixes #10331

changelog: [`map_entry`]: do not base suggestion on code expanded by the compiler
2023-02-14 23:21:08 +00:00
bors
5a8b288712 Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #107573 (Update the minimum external LLVM to 14)
 - #107626 (Fix `x fix` on the standard library itself)
 - #107673 (update ICU4X to 1.1.0)
 - #107733 (Store metrics from `metrics.json` to CI PGO timer)
 - #108007 (Use `is_str` instead of string kind comparison)
 - #108033 (add an unstable `#[rustc_coinductive]` attribute)
 - #108039 (Refactor refcounted structural_impls via functors)
 - #108040 (Use derive attributes for uninteresting traversals)
 - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-14 21:07:04 +00:00
Camille GILLOT
e41c37316d Add of_trait to DefKind::Impl. 2023-02-14 19:55:44 +00:00
Samuel Tardieu
e4e5924b99 Do not base map_entry lint suggestion on expanded code 2023-02-14 15:37:48 +01:00
Samuel Tardieu
657ee48bec Ignore instructions following a break from block in never_loop lint
It is not sufficient to ignore break from a block inside the loop.
Instructions after the break must be ignored, as they are unreachable.
This is also true for all instructions in outer blocks and loops
until the right block is reached.
2023-02-14 09:55:44 +01:00
Oli Scherer
e3a739a115 s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
Samuel Tardieu
e9dffa3910 Fix a bug in never_loop when anonymous blocks are nested in named blocks
The following code

```
loop {
    'a: {
        { }
        break 'a;
    }
}
```

was detected as a never-looping loop.
2023-02-14 09:23:04 +01:00
J-ZhengLi
8e96adedd5 fix [needless_return] incorrect suggestion when returning if sequence 2023-02-14 11:31:42 +08:00
Samuel Tardieu
1fec2927c5 Replace combine_both by combine_seq
All evaluations now happen in order.
2023-02-13 22:34:05 +01:00
Samuel Tardieu
c231b41887 Remove useless call to combine_seq
`combine_seq(x, NeverLoopResult::Otherwise)`  always returns `x`
2023-02-13 22:34:05 +01:00
Armin Ronacher
89314a0805 Add question-mark-used lint
This lint complains when the question mark operator (try operator)
is used.  This is a restriction lint that can be useful on local
scopes where a custom error handling macro is supposed to be used
to augment the error based on local scope data before returning.
2023-02-13 20:59:26 +01:00
Michael Goulet
4b8f112d09 Use is_str instead of string kind comparison 2023-02-13 19:06:22 +00:00
bors
ac60dcaa25 Auto merge of #10177 - chansuke:almost_swapped, r=Alexendoo
Almost swapped

Take over from https://github.com/rust-lang/rust-clippy/pull/8945

Fix https://github.com/rust-lang/rust-clippy/issues/8151

---

changelog: enhancement: [`almost_swapped`]: Now detects almost swaps using `let` statements
[#10177](https://github.com/rust-lang/rust-clippy/pull/10177)
<!-- changelog_checked -->
2023-02-13 13:20:18 +00:00
Matthias Krüger
b3077fbc09 Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa
Introduce `-Zterminal-urls` to use OSC8 for error codes

Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-13 11:34:57 +01:00
chansuke
ebca1b5d00 Refactor almost_swapped to lint with let statement correctly 2023-02-13 16:16:31 +09:00
bors
298f139798 Auto merge of #10317 - m-ou-se:suspicious-command-arg-space, r=Manishearth
Add `suspicious_command_arg_space` lint

Fixes #10316

---

changelog: New lint: [`suspicious_command_arg_space`]
[#10317](https://github.com/rust-lang/rust-clippy/pull/10317)
<!-- changelog_checked -->
2023-02-12 21:57:49 +00:00
Mara Bos
1f77866991 Add SUSPICIOUS_COMMAND_ARG_SPACE to lint pass. 2023-02-12 22:00:13 +01:00
bors
6f353fdf0a Auto merge of #10310 - c410-f3r:arith-2, r=Alexendoo
[arithmetic_side_effects] Fix #10209

Fix #10209

---

changelog: Enhancement: [`arithmetic_side_effects`]: No longer lints, if safe constant values are used.
[#10310](https://github.com/rust-lang/rust-clippy/pull/10310)
<!-- changelog_checked -->
2023-02-12 19:34:15 +00:00
Caio
1ed8ed3435 Address comment 2023-02-12 16:27:30 -03:00
Caio
e70a7a68bd [arithmetic_side_effects] Evaluate integers originated from constant declarations 2023-02-12 16:19:51 -03:00
Caio
1b286b128b Address comments 2023-02-12 16:17:37 -03:00
Samuel Tardieu
09d3097734 manual_let_else: do not suggest semantically different replacements 2023-02-12 20:07:23 +01:00
Samuel Tardieu
d9dc1679f5 cast_possible_truncation: issue proper help message 2023-02-12 08:56:21 +01:00
Michael Krasnitski
8789b37d06 Fix false positives for extra_unused_type_parameters 2023-02-11 12:22:25 -05:00
Caio
078f149aa4 [significant_drop_tightening] Add MVP 2023-02-10 15:07:34 -03:00
Mara Bos
8f56767c94 Update lints. 2023-02-10 19:03:20 +01:00
Mara Bos
984c47b9f4 Clarify description of suspicious_command_arg_space.
Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
2023-02-10 19:02:39 +01:00
Mara Bos
145e6a94d6 Add suspicious_command_arg_space lint. 2023-02-10 19:02:39 +01:00
Philipp Krones
e7fe1f9c14 Merge commit '0f7558148c22e53cd4608773b56cdfa50dcdeac3' into clippyup 2023-02-10 14:01:19 +01:00
Philipp Krones
7c61b4ed89
Merge remote-tracking branch 'upstream/master' into rustup 2023-02-10 11:33:45 +01:00
DevAccentor
179c037643 improve almost swap to look for let statement 2023-02-10 18:00:46 +09:00
Christian Poveda
cc19fbe177
update metadata 2023-02-09 16:53:34 -05:00
Christian Poveda
e2e23c0045
Add docs and update tests 2023-02-09 16:41:45 -05:00
Esteban Küber
374c393a93 Introduce -Zterminal-urls to use OSC8 for error codes
Terminals supporting the OSC8 Hyperlink Extension can support inline
anchors where the text is user defineable but clicking on it opens a
browser to a specified URLs, just like `<a href="URL">` does in HTML.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09 14:52:54 +00:00
bors
5adeebf92f Auto merge of #10292 - xFrednet:0000-support-trait-item-in-dump, r=flip1995
Make `[clippy::dump]` support trait items

Roses are red,
violets are blue,
trait items are rare,
`[clippy::dump]` is too

---

Let's just ignore the horrible poem... anyways. While working on Marker I noticed, that `[clippy::dump]` doesn't work on trait item (See [Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e2d9791ffa2872e7c09a9dfbd470350c)). This simply adds support for that. `[clippy::dump]` doesn't have UI tests, to make it more resistant to changes in the AST. I tested it locally and the dump works after these changes.

---

changelog: none
2023-02-09 13:22:00 +00:00
bors
fd2d8beaf8 Auto merge of #10293 - Alexendoo:bool-assert-comparison-negation, r=dswij
Negate suggestions when needed in `bool_assert_comparison`

changelog: none assuming this gets into the same release as #10218

Fixes #10291

r? `@dswij`

Thanks to `@black-puppydog` for spotting it early
2023-02-08 23:03:32 +00:00
Christian Poveda
c6692a8b42
Add configuration to lint missing docs of pub(crate) items 2023-02-06 14:21:37 -05:00
Kartavya Vashishtha
2fc1693cd5
split suggestions into two separate suggestions 2023-02-06 21:34:35 +05:30
Kartavya Vashishtha
63a57ee1c3
retain applicability 2023-02-05 01:50:44 +05:30
Kartavya Vashishtha
1fb42daf11
use span_suggestions to suggest both intents 2023-02-05 01:05:31 +05:30
Alex Macleod
5546c82051 Negate suggestions when needed in bool_assert_comparison 2023-02-04 19:28:11 +00:00
xFrednet
c642cfe3bf
Make [clippy::dump] support trait items 2023-02-04 19:34:31 +01:00
Michael Krasnitski
fba16e2e3a Add extra_unused_type_parameters lint 2023-02-02 19:37:34 -05:00
bors
006a4cc767 Auto merge of #10276 - m-ou-se:manual-assert, r=Alexendoo
Don't depend on FormatArgsExpn in ManualAssert.

Part of https://github.com/rust-lang/rust-clippy/issues/10233

changelog: none
2023-02-02 14:47:43 +00:00
Mara Bos
f7d59b2e57 Don't depend on FormatArgsExpn in ManualAssert. 2023-02-01 22:50:43 +01:00
bors
a2f85deba3 Auto merge of #10250 - tylerjw:issue_7419, r=xFrednet
wildcard_enum_match_arm lint takes the enum origin into account

fixes #7419

---

changelog: Enhancement: [`wildcard_enum_match_arm`]: Now lints missing private variants, for local enums
[#10250](https://github.com/rust-lang/rust-clippy/pull/10250)
<!-- changelog_checked -->
2023-02-01 20:01:56 +00:00
bors
588c1ba3ff Auto merge of #10270 - kadiwa4:update_some_deps, r=flip1995
Update dependencies `cargo_metadata` and `clap`

changelog: none

Allows removing some duplicate dependencies in rust-lang/rust's `Cargo.lock`.
2023-02-01 16:34:05 +00:00
bors
75d76806c1 Auto merge of #10256 - SylvainDe:master, r=giraffate
Fix version declared for semicolon_inside_block and semicolon_outside…

As per Issue #10244, the lint were documentated
as being part of 1.66.0 but will actually be
released 1.68.0 .

changelog: [`semicolon_inside_block`]: Documentation fix
Fixes #10244
2023-02-01 00:24:04 +00:00
KaDiWa
ef2596155d
update some dependencies 2023-01-31 23:31:12 +01:00
bors
2880dccabb Auto merge of #10265 - Manishearth:uninlined-fmt-pedantic, r=Alexendoo
Mark uninlined_format_args as pedantic

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

We should restore this when rust-analyzer support gets better. Worth filing an issue to track.

changelog: Mark [`uninlined_format_args`] as `pedantic`
2023-01-31 19:21:44 +00:00
Alex Macleod
6a8b20230b Add machine applicable suggestion for needless_lifetimes
Also adds a test for #5787
2023-01-31 14:12:03 +00:00
bors
607e3e893e Auto merge of #10114 - tgross35:option-let-else-wording, r=flip1995
option_if_let_else: update known problems wording

changelog: none
<!-- changelog_checked -->
2023-01-31 09:36:15 +00:00
bors
d227f18c2e Auto merge of #10225 - evantypanski:et/issue10132, r=flip1995
[`unused_io_amount`]: Lint with `is_ok` and `is_err`

Fixes #10132

changelog: Apply [`unused_io_amount`] lint to `is_ok` and `is_err` without checking read/write amount
2023-01-31 08:20:21 +00:00
Manish Goregaokar
b4e2b48270 Mark uninlined_format_args as pedantic 2023-01-30 19:28:27 -08:00
Tyler Weaver
df7cdf732d
Pull the is_external test out of the loop 2023-01-30 17:29:29 -07:00
Tyler Weaver
c531b09eb8
Check external before hidden 2023-01-30 17:29:29 -07:00
Tyler Weaver
2432e97d6a
wildcard_enum_match_arm lint takes the enum origin into account
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-30 17:29:29 -07:00
Tyler Weaver
4fde96c30e
Test needless_lifetimes within external macro
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-30 16:16:53 -07:00
bors
d020fd7fe6 Auto merge of #10260 - Niki4tap:external_macro_fp, r=xFrednet
`multiple_unsafe_ops_per_block`: Don't lint in external macros

Fixes #10259

changelog: FP: [`multiple_unsafe_ops_per_block`]: No longer lints in external macros
[#10260](https://github.com/rust-lang/rust-clippy/pull/10260)
<!-- changelog_none -->
2023-01-30 20:10:19 +00:00
bors
173fac0989 Auto merge of #10255 - khayyamsaleem:issue_9520, r=Jarcho
prevents `len_without_is_empty` from yielding positive when `len` takes arguments besides `&self`

Fixes #9520

---

changelog: FP [`len_without_is_empty`]: No longer lints, if `len` as a non-default signature
[#10255](https://github.com/rust-lang/rust-clippy/pull/10255)
<!-- changelog_checked -->
2023-01-30 19:08:04 +00:00
Niki4tap
926c5e4cde multiple_unsafe_ops_per_block: don't lint in external macros 2023-01-30 20:42:40 +03:00
bors
d92070a7b9 Auto merge of #10254 - tylerjw:issue_6929, r=Manishearth
needless_range_loop: improve documentation

fixes #6929

changelog: [`needless_range_loop`]: improve documentation
2023-01-30 17:30:32 +00:00
Tyler Weaver
3b225e3a96
Update clippy_lints/src/loops/needless_range_loop.rs
Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
2023-01-30 09:59:26 -07:00
bors
8fb0041f47 Auto merge of #10248 - koka831:missing-config, r=xFrednet
Missing config

This PR addresses https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Some.20lints.20miss.20its.20config/near/318460000.

changelog: Documentation: Made sure that lint configurations on Clippy's lint list are all up to date
[#10248](https://github.com/rust-lang/rust-clippy/pull/10248)
<!-- changelog_checked -->

r? `@xFrednet`

---

I have tried to create [a prototype](https://github.com/koka831/rust-clippy/pull/1), but have not yet found a good way to implement it.
So I would like to put it aside for now and try again after addressing other issues so that I can understand how clippy works better:)
2023-01-30 16:40:25 +00:00
koka
a9e6b12854
fix: use correct lint name
fix
2023-01-30 20:35:35 +09:00
Sylvain Desodt
ecde2019e9 Fix version declared for semicolon_inside_block and semicolon_outside_block
As per Issue #10244, the lint were documentated
as being part of 1.66.0 but will actually be
released 1.68.0 .
2023-01-30 10:01:38 +01:00
ksaleem
2fd94a4e01 prevents len_without_is_empty from yielding positive when len takes
more than just `&self` in non-standard implementations.

changelog: Fix [`len_without_is_empty`] false positive when len has a
non-standard method signature

Fixes #9520
2023-01-29 17:35:36 -05:00
Tyler Weaver
4d266d31de
needless_range_loop: improve documentation 2023-01-29 11:41:53 -07:00
bors
96c28d1f69 Auto merge of #10231 - Alexendoo:regex-spans, r=llogiq
`invalid_regex`: Show full error when string value doesn't match source

changelog: [`invalid_regex`]: Show full error when parsing non-literals or regular strings containing escape sequences

Fixes #4170, the escape sequence there causes the span to be incorrect which will have caused most of the confusion
2023-01-29 14:13:58 +00:00
koka
af62bf95a3
fix key name of MUTABLE_KEY_TYPE 2023-01-29 03:13:30 +09:00
koka
d87a6bc9b1
add MANUAL_RETAIN to msrv
MANUAL_RETAIN uses
- msrvs::STRING_RETAIN
- msrvs::BTREE_SET_RETAIN
- msrvs::BTREE_MAP_RETAIN
- msrvs::HASH_SET_RETAIN
- msrvs::HASH_MAP_RETAIN
2023-01-29 03:07:09 +09:00
koka
2f4b047b27
add MANUAL_REM_EUCLID to msrv
MANUAL_REM_EUCLID uses msrvs::REM_EUCLID
2023-01-29 03:04:56 +09:00
koka
1766532b20
add MANUAL_IS_ASCII_CHECK to msrv
MANUAL_IS_ASCII_CHECK uses msrvs::IS_ASCII_DIGIT and msrvs::IS_ASCII_DIGIT_CONST
2023-01-29 03:02:23 +09:00
koka
25d455bd17
fix: add missing dot to suppress_restriction_lint_in_const 2023-01-29 02:54:26 +09:00
koka
e791522d35
add DERIVABLE_IMPLS to msrv
DERIVABLE_IMPLS uses msrvs::DEFAULT_ENUM_ATTRIBUTE
2023-01-29 02:39:37 +09:00
koka
fb77b02789
add NEEDLESS_BORROW to msrv
NEEDLESS_BORROW uses msrvs::ARRAY_INTO_ITERATOR
2023-01-29 02:37:00 +09:00
koka
7716d69757
fix: add missing dot to AWAIT_HOLDING_INVALID_TYPE 2023-01-29 02:27:43 +09:00
koka
e65f9f9d32
add ALMOST_COMPLETE_RANGE to msrv
ALMOST_COMPLETE_RANGE uses msrvs::RANGE_INCLUSIVE
2023-01-29 02:22:10 +09:00
koka
07a8bf15ff
add TRANSMUTE_PTR_TO_REF to msrv
TRANSMUTE_PTR_TO_REF uses msrvs::POINTER_CAST
2023-01-29 02:14:38 +09:00
koka
532841fcae
add UNNECESSARY_LAZY_EVALUATIONS to msrv
UNNECESSARY_LAZY_EVALUATIONS uses msrvs::BOOL_THEN_SOME for `then` to
`then_some`
2023-01-29 02:02:46 +09:00