bors
1eb254ef83
Auto merge of #11242 - samueltardieu:issue-11238, r=Centri3,giraffate
...
New lint `ignored_unit_patterns`
This idea comes from #11238 . I've put the lint in `pedantic` as it might trigger numerous positives (three in Clippy itself).
changelog: [`ignored_unit_patterns`]: new lint
2023-08-03 01:04:39 +00:00
bors
ff27f9095f
Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-macro, r=estebank
...
Avoid wrong code suggesting for attribute macro
Fixes #107113
r? `@estebank`
2023-08-02 23:04:27 +00:00
bors
237dd599db
Auto merge of #11288 - Centri3:#11278, r=Alexendoo
...
[`ptr_as_ptr`]: Take snippet instead of pretty printing type
Fixes #11278
changelog: [`ptr_as_ptr`]: Include leading `super`s in suggestion
2023-08-02 22:32:35 +00:00
Catherine Flores
fef85c9083
Take snippet instead of pretty printing type
2023-08-02 17:26:25 -05:00
bors
97d1cfa2b4
Auto merge of #11286 - Centri3:#11283, r=Alexendoo
...
Suppress `question_mark` warning if `question_mark_used` is not allowed
Closes #11283
changelog: [`question_mark`]: Don't lint if `question_mark_used` is not allowed
2023-08-02 22:20:30 +00:00
Catherine Flores
4d49065a6c
Suppress question_mark
if question_mark_used
is not allowed
2023-08-02 14:13:16 -05:00
Catherine Flores
71c54137ea
Extract never-like into clippy_utils
2023-08-02 14:00:26 -05:00
Catherine Flores
779e0f4021
Do not lint unwrapping on !
or never-like enums
2023-08-02 14:00:12 -05:00
Deadbeef
b07de24a58
Remove constness from TraitPredicate
2023-08-02 15:38:00 +00:00
Your Name
72074a0f00
Alphabetically order arms in methods/mod.rs match
2023-08-02 16:44:26 +08:00
yukang
0ff6579eac
fix RedundantLocals clippy caused by async and await
2023-08-02 16:32:49 +08:00
Urgau
7ef1a54ffe
Rename incorrect_fn_null_checks to useless_ptr_null_checks (clippy side)
2023-08-01 20:04:01 +02:00
bors
588c1abb76
Auto merge of #11269 - y21:issue11268, r=Centri3
...
[`unnecessary_mut_passed`]: don't lint in macro expansions
Fixes #11268
changelog: [`unnecessary_mut_passed`]: don't lint in macro expansions
2023-08-01 05:15:09 +00:00
Philipp Krones
b0e64a9c09
Merge commit '5436dba826191964ac1d0dab534b7eb6d4c878f6' into clippyup
2023-07-31 23:53:53 +02:00
Samuel "Sam" Tardieu
f9a6dfa60d
New lint ignored_unit_patterns
2023-07-31 22:00:53 +02:00
y21
dc1e8b0dd9
[unnecessary_mut_passed
]: don't lint in macro expansions
2023-07-31 21:09:52 +02:00
Oli Scherer
084c90a305
Remove a bool
for color in favor of the WriteColor
trait wrapping colored and uncolored printing
2023-07-31 09:34:36 +00:00
Oli Scherer
9a0af82781
Use builder pattern instead of lots of arguments for EmitterWriter::new
2023-07-31 09:34:30 +00:00
bors
5436dba826
Auto merge of #11263 - c410-f3r:let-chain, r=Centri3
...
[`arithmetic_side_effects`] Fix #11262
Fix #11262
Rustc already handles paths that refer literals -> https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d795058a2e1634c867288c20ff9432c8
```
changelog: [`arithmetic_side_effects`]: Ignore paths that refer literals
```
2023-07-30 20:16:57 +00:00
bors
2ab124126d
Auto merge of #11261 - y21:issue11260, r=blyxyas
...
[`unnecessary_find_map`]: look for then_some
Closes #11260
changelog: [`unnecessary_find_map`]: lint `.then_some()` in closure
2023-07-30 18:26:45 +00:00
Caio
35d434d08e
[arithmetic_side_effects] Fix #11262
2023-07-30 14:33:38 -03:00
Matthias Krüger
f54263af58
Rollup merge of #112655 - WaffleLapkin:must_use_map_or, r=workingjubilee
...
Mark `map_or` as `#[must_use]`
I don't know what else to say.
r? libs
2023-07-30 14:25:08 +02:00
y21
008746cae4
[unnecessary_find_map
]: look for then_some
2023-07-30 13:51:35 +02:00
Maybe Waffle
0c93e30956
Mark map_or
as #[must_use]
2023-07-30 10:22:23 +00:00
Jason Newcomb
7423c2760b
Don't lint redundant closure for any function call inserted by the compiler.
2023-07-30 01:19:36 -04:00
Jason Newcomb
4d80a2ed2e
Rework redundant_closure
...
* Better track when a early-bound region appears when a late-bound region is required
* Don't lint when the closure gives explicit types.
2023-07-30 01:19:29 -04:00
Jason Newcomb
71cc39e1f2
Add debug assertions to implements_trait
...
Improve debug assertions for `make_projection`
2023-07-30 00:38:04 -04:00
bors
436060f637
Auto merge of #113422 - Urgau:cast_ref_to_mut-pre-beta, r=Nilstrieb
...
Rename and allow `cast_ref_to_mut` lint
This PR is a small subset of https://github.com/rust-lang/rust/pull/112431 , that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`).
BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until https://github.com/rust-lang/rust/pull/112431 is merged.
r? `@Nilstrieb`
2023-07-29 07:48:44 +00:00
Philipp Krones
3d60241841
Merge remote-tracking branch 'upstream/master' into rustup
2023-07-28 23:44:28 +02:00
León Orell Valerian Liehr
4c9d68e9b8
Make Clippy understand generic const items
2023-07-28 22:21:41 +02:00
bors
d3c5b488db
Auto merge of #11210 - y21:readonly_write_lock, r=giraffate
...
new lint: [`readonly_write_lock`]
Closes #8555
A new lint that catches `RwLock::write` calls to acquire a write lock only to read from it and not actually do any writes (mutations).
changelog: new lint: [`readonly_write_lock`]
2023-07-28 13:08:02 +00:00
y21
5e88003dda
pattern match on local usage slice to avoid ICE
2023-07-28 12:52:06 +02:00
bors
295bdc028f
Auto merge of #10759 - blyxyas:unset_opt_env_unwrap, r=flip1995
...
Now `option_env_unwrap` warns even if a variable isn't set at compiletime
Fixes #10742
changelog: Fix false negative where `option_env_unwrap` wouldn't warn if the env variable isn't set at compile-time.
2023-07-27 19:52:46 +00:00
Timo
205a3741c1
make lint description more consistent (writer/reader -> write/read)
...
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2023-07-27 21:19:35 +02:00
y21
136339f2d3
new lint: [readonly_write_lock
]
2023-07-27 21:19:35 +02:00
Deadbeef
39fb315396
bless clippy
2023-07-27 17:56:25 +00:00
Deadbeef
be0b4d5a9b
Remove constness
from ParamEnv
2023-07-27 15:50:42 +00:00
blyxyas
3bfccacca9
Add comments + Very minor Refactor
2023-07-26 23:16:24 +02:00
Matthias Krüger
8615595021
Rollup merge of #114070 - blyxyas:iter_mut_symbol, r=oli-obk
...
Add `sym::iter_mut` + `sym::as_mut_ptr` for Clippy
We currently have `sym::iter` and `sym::iter_repeat`, this PR adds `sym::iter_mut` as it's useful for https://github.com/rust-lang/rust-clippy/pull/11038 and another Clippy lint, it also adds `sym::as_mut_ptr` as it's useful for https://github.com/rust-lang/rust-clippy/pull/10962 .
2023-07-26 20:49:13 +02:00
blyxyas
4e1db44404
Now option_env_unwrap
warns even if a variable isn't set at compile time.
2023-07-26 18:57:57 +02:00
bors
ed2ec819e9
Auto merge of #114054 - oli-obk:cleanups, r=estebank
...
Split some functions with many arguments into builder pattern functions
r? `@estebank`
This doesn't resolve all of the ones in rustc, mostly because I need to do other cleanups in order to be able to use some builder derives from crates.io
Works around https://github.com/rust-lang/rust/issues/90672 by making `x test rustfmt --bless` format itself instead of testing that it is formatted
2023-07-26 11:17:35 +00:00
bors
0d0dbae550
Auto merge of #11233 - Centri3:#11232, r=Jarcho
...
[`arc_with_non_send_sync`]: No longer lints macro-generated code
Fixes #11232
changelog: [`arc_with_non_send_sync`]: No longer lints macro-generated code
2023-07-26 03:26:10 +00:00
blyxyas
0404b6b6c2
Add sym::iter_mut
+ sym::as_mut_ptr
2023-07-25 23:33:08 +00:00
Catherine Flores
90947e95ad
[arc_with_non_send_sync
]: Check if it's macro-generated
2023-07-25 18:09:59 -05:00
Catherine
3235d9d612
Only lint Copy
types
2023-07-25 17:51:05 -05:00
Catherine
978b1daf99
New lint [filter_map_bool_then
]
2023-07-25 17:42:36 -05:00
bors
2153c0fcc8
Auto merge of #11226 - GuillaumeGomez:needless-ref-mut-cfg, r=llogiq
...
Needless ref mut cfg
Fixes https://github.com/rust-lang/rust-clippy/issues/11185 .
cc `@Centri3`
changelog: Emit note if function is behind a cfg for `NEEDLESS_PASS_BY_REF_MUT` lint.
2023-07-25 19:00:59 +00:00
bors
70c5798993
Auto merge of #11198 - y21:issue10938, r=Centri3
...
[`slow_vector_initialization`]: catch `Vec::new()` followed by `.resize(len, 0)`
Closes #10938
changelog: [`slow_vector_initialization`]: catch `Vec::new()` followed by `.resize(len, 0)`
2023-07-25 17:23:01 +00:00
y21
c0484b74f7
simplify looking for Vec::with_capacity
exprs
2023-07-25 18:56:57 +02:00
Guillaume Gomez
1c9772c773
Move inherits_cfg
function into clippy_utils
2023-07-25 18:43:58 +02:00