bors
7c595b4599
Auto merge of #11305 - y21:issue11304, r=Centri3
...
[`redundant_guards`]: don't lint on float literals
Fixes #11304
changelog: [`redundant_guards`]: don't lint on float literals
r? `@Centri3` i figured you are probably a good reviewer for this since you implemented the lint ^^
2023-08-08 16:18:06 +00:00
y21
b6156502af
document the new behavior and add test for float in struct
2023-08-08 18:04:57 +02:00
y21
f959ccc09b
[redundant_guards
]: don't lint on floats
2023-08-08 17:19:53 +02:00
bors
84d2896747
Auto merge of #11295 - lengyijun:typo, r=Centri3
...
Small code style adjustments
changelog: none
2023-08-07 03:23:23 +00:00
bors
526d1156bd
Auto merge of #11191 - Alexendoo:redundant-type-annotations-ice, r=llogiq
...
redundant_type_annotations: only pass certain def kinds to type_of
Fixes #11190
Fixes rust-lang/rust#113516
Also adds an `is_lint_allowed` check to skip the lint when it's not needed
changelog: none
2023-08-06 18:45:38 +00:00
Manish Goregaokar
d628046244
Update clippy_lints/src/operators/mod.rs
...
Co-authored-by: Catherine Flores <catherine.3.flores@gmail.com>
2023-08-06 17:19:43 +00:00
Morten Lohne
3157b96a5b
Provide fallback code snippets, if the snippet is not available
2023-08-06 13:49:17 +02:00
Morten Lohne
0e064d5d04
Replace ConstEvalLateContext::new() with two calls to constant() to simplify the code, after PR suggestion
2023-08-06 13:48:28 +02:00
Morten Lohne
9646446923
Add lifetime parameter to 'Constant', after rebasing on upstream
2023-08-06 13:29:50 +02:00
Morten Lohne
1d61fc1b0a
Rename 'impossible_double_const_comparisons' -> 'impossible_comparisons' and 'ineffective_double_const_comparisons' -> 'redundant_comparisons', after discussion on Zulip
2023-08-05 21:28:08 +02:00
Morten Lohne
b5ef66f442
Optimize by doing a cheap check for double binary expression first
2023-08-05 21:28:08 +02:00
Morten Lohne
08e1333fa6
Add missing variable decl to doc comment
2023-08-05 21:28:08 +02:00
Morten Lohne
e16a2ac0c6
Add descriptions for 'impossible_double_const_comparisons' and 'ineffective_double_const_comparisons'
2023-08-05 21:28:08 +02:00
Morten Lohne
046d3df35e
New lints: impossible_double_const_comparisons
and ineffective_double_const_comparisons
2023-08-05 21:28:08 +02:00
lengyijun
e5b0483c85
Small code style adjustments
2023-08-05 12:41:20 +08:00
bors
5818225a89
Auto merge of #11255 - blyxyas:fix-perf-sus_xor_used_as_pow, r=xFrednet
...
Fix `suspicious_xor_used_as_pow.rs` performance
The original `suspicious_xor_used_as_pow` lint had poor performance, so I fixed that + a little refactor so that module is readable.
**107 millis. -> 106 millis.** Using `SPEEDTEST` on Rust's VMs
fix #11060
changelog: [`suspicious_xor_used_as_pow`]: Improve performance by 0.934%
2023-08-03 20:07:54 +00:00
blyxyas
3fb84415cd
Fix suspicious_xor_used_as_pow.rs
performance
2023-08-03 21:58:59 +02:00
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
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
Your Name
72074a0f00
Alphabetically order arms in methods/mod.rs match
2023-08-02 16:44:26 +08: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
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
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
y21
008746cae4
[unnecessary_find_map
]: look for then_some
2023-07-30 13:51:35 +02: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
Philipp Krones
3d60241841
Merge remote-tracking branch 'upstream/master' into rustup
2023-07-28 23:44:28 +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
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