Commit Graph

7513 Commits

Author SHA1 Message Date
Catherine Flores
7b2fd81f43 Add test for &mut 2023-08-10 16:33:07 -05:00
Catherine Flores
beb57f074e Don't ICE with late bound regions 2023-08-10 16:26:22 -05:00
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
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
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
8f40d09e0f Add tests for const comparisons that compare two different types 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
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
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
be6a103c8c add more tests to unnecessary_find_map and unnecessary_filter_map 2023-07-30 16:52:53 +02:00
y21
008746cae4 [unnecessary_find_map]: look for then_some 2023-07-30 13:51:35 +02:00
Jason Newcomb
caf601434b Resolve type aliases in type_certainty 2023-07-30 03:26:32 -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
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
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
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
Trevor Gross
6ca6be6f2b Unite bless environment variables under RUSTC_BLESS
Currently, Clippy, Miri, Rustfmt, and rustc all use an environment variable to
indicate that output should be blessed, but they use different variable names.
In order to improve consistency, this patch applies the following changes:

- Emit `RUSTC_BLESS` within `prepare_cargo_test` so it is always
  available
- Change usage of `MIRI_BLESS` in the Miri subtree to use `RUSTC_BLESS`
- Change usage of `BLESS` in the Clippy subtree to `RUSTC_BLESS`
- Change usage of `BLESS` in the Rustfmt subtree to `RUSTC_BLESS`
- Adjust the blessable test in `rustc_errors` to use this same
  convention
- Update documentation where applicable

Any tools that uses `RUSTC_BLESS` should check that it is set to any value
other than `"0"`.
2023-07-26 16:54:02 -04: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
Matthias Krüger
01b9f9d9da ci: test that we fail CI if we don't find clippy panicking 2023-07-26 17:05:20 +02:00
bors
fc13bf8be2 Auto merge of #11225 - matthiaskrgr:fix_integration_tests2, r=flip1995
Fix integration tests #2

fix integration tests.

It turned out that the following tests fail to build at all:

chalk, combine, stdarch and hyper.

This is often a problem of passing `--all-targets --all-features`, in case of combine though, outdated deps were to blame.

I have opened tickets against combine and rustfmt
https://github.com/rust-lang/rustfmt/issues/5859
https://github.com/Marwes/combine/issues/357

should we just remove the other failing repos? :/

changelog: fix integration tests on ci
2023-07-26 08:55:48 +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
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
Matthias Krüger
12b63f5c35 ci: integration tests: print clippy run output and set LD_LIBRARY_PATH to rustc sysroot 2023-07-25 19:39:50 +02: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
Guillaume Gomez
04b710b569 Use libtest errors check to better enforce UI testing 2023-07-25 18:43:58 +02:00
Guillaume Gomez
15de3dd2af Add a note if the function is behind a cfg 2023-07-25 18:08:16 +02:00
Ralf Jung
2b16c37b65 bless more 2023-07-25 14:30:58 +02:00
bors
d09c8a9387 Auto merge of #11221 - Alexendoo:ui-test-text, r=flip1995
Remove Gha status emitter in compile-test

Disables the github specific output for now since it can be a bit confusing - https://github.com/oli-obk/ui_test/issues/109, in particular the truncation/repetition

r? `@flip1995`

changelog: none
2023-07-25 08:29:27 +00:00
Catherine Flores
ef482d17f2 Do not lint if used as a fn-like argument 2023-07-24 19:29:23 -05:00
bors
867e0ec024 Auto merge of #11218 - MrNossiom:master, r=Manishearth
changelog: [`min_ident_chars`]: don't lint const generics

Fixes: #11163

changelog: [`min_ident_chars`]: don't lint const generics
2023-07-24 21:26:56 +00:00