Commit graph

6933 commits

Author SHA1 Message Date
y21
9613ea85c6 fix run-rustfix directive 2023-04-29 19:10:52 +02:00
y21
8d8178f931 rename lint to manual_while_let_some 2023-04-29 18:59:07 +02:00
y21
1d08325293 move lint to loops, emit proper suggestion, more tests 2023-04-29 18:59:07 +02:00
y21
bb58083ce5 new lint: while_pop_unwrap 2023-04-29 18:59:06 +02:00
bors
3594d55439 Auto merge of #10719 - blyxyas:fix-items_after_test_mod_imported_modules, r=Alexendoo
Fix `items_after_test_module`: Ignore imported modules

Fixes #10713. It does a little bit of dark magic, but intention is what really counts.
changelog:[`items_after_test_module`]: Ignore imported modules (`mod foo;`) with no body.
2023-04-28 18:42:58 +00:00
blyxyas
395b1f5bf3
Rename items + Delete imported_module.stderr 2023-04-28 20:40:47 +02:00
blyxyas
2b5820d58b
Change module import system 2023-04-28 20:23:05 +02:00
blyxyas
273c898aef
Fix #10713 and move the tests to a subdir 2023-04-27 16:43:51 +02:00
bors
990bbdc2be Auto merge of #10656 - Centri3:master, r=xFrednet
Add configuration for `semicolon_block` lints

Does exactly what it says on the tin, suggests moving a block's final semicolon inside if it's multiline and outside if it's singleline.

I don't really like how this is implemented so I'm not too sure if this is ready yet. Alas, it might be ok.

---

fixes #10654

changelog: Enhancement: [`semicolon_inside_block`]: Added `semicolon-inside-block-ignore-singleline` as a new config value.
[#10656](https://github.com/rust-lang/rust-clippy/pull/10656)
changelog: Enhancement: [`semicolon_outside_block`]: Added `semicolon-outside-block-ignore-multiline` as a new config value.
[#10656](https://github.com/rust-lang/rust-clippy/pull/10656)
<!-- changelog_checked -->
2023-04-25 20:12:00 +00:00
Centri3
e3ee10d428 use //@ for commands in tests 2023-04-25 11:23:02 -05:00
Centri3
aa6c27a74e change names to not be implicitly negative 2023-04-25 11:14:52 -05:00
Centri3
14a6fa4a34 use in_external_macro 2023-04-25 05:06:45 -05:00
Centri3
1ac30d3c86 make cargo test pass 2023-04-25 05:06:11 -05:00
Centri3
8efe9ff9fb run cargo dev fmt 2023-04-25 05:06:11 -05:00
Centri3
acfb2c45ba don't check if from macro invocation 2023-04-25 05:06:11 -05:00
bors
c4f2c48d9b Auto merge of #10702 - blyxyas:fix-let_underscore_untyped_help_message, r=Manishearth
Improve the help message + add a help span

This would close #10410, because it applies the general consensus achieved in that issue (that replacing `let _ = ...` to `_ = ...` doesn't present any benefits).

I also added a little help message span.

changelog:[`let_underscore_untyped`]: Fix the help message confusion + add a help message span.
2023-04-24 20:28:34 +00:00
bors
30db6edf36 Auto merge of #10707 - y21:redudant_pattern_matching_rest_pat, r=Manishearth
check for `..` pattern in `redundant_pattern_matching`

The `redundant_pattern_matching` lint currently checks for `if let Some(_) = ...`, but not for `if let Some(..) = ...`.
This PR makes sure to also check for the `..` pattern in tuple structs.
It also found one such instance in clippy itself so that shows it's worth checking for this pattern as well 😅

changelog: [`redundant_pattern_matching`]: check for `..` pattern in tuple structs
2023-04-24 19:33:53 +00:00
bors
4b6fdb4dff Auto merge of #10683 - Centri3:allow-attributes, r=Alexendoo
Fix false positive in `allow_attributes`

This would emit a warning if used in a proc-macro with the feature `lint_reasons` enabled. This is now fixed.

changelog: [`allow_attributes`]: Don't lint if in external macro
2023-04-24 17:52:17 +00:00
Centri3
3045998bcc Update allow_attributes_false_positive.rs 2023-04-24 12:01:29 -05:00
bors
5161c4ce4d Auto merge of #10697 - lochetti:fix_9757, r=dswij
Ignore `shadow` warns in code from macro expansions

This PR fixes https://github.com/rust-lang/rust-clippy/issues/9757

I am in doubt if just looking for `pat.span.from_expansion()` would be sufficient instead of looking for both `pat.span.desugaring_kind().is_some()` or `pat.span.from_expansion()`. The tests (including the new one) passes if I leave the only `if pat.span.from_expansion()`. Any feedbacks?

Also, this is my first PR here, sorry for anything and thanks for the patience!

changelog: [`shadow_same`, `shadow_reuse`, `shadow_unrelated`]: avoiding warns in macro-generated code
2023-04-24 06:25:52 +00:00
bors
96f8471d81 Auto merge of #10649 - jsoref:spelling, r=Jarcho
Spelling

This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling).

The misspellings have been reported at https://github.com/jsoref/rust-clippy/actions/runs/4710771873#summary-12776860721

The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-clippy/actions/runs/4710771874#summary-12776860722

changelog: none
2023-04-23 22:30:06 +00:00
y21
e8726b20b2 also check for rest pat in redundant_pattern_matching 2023-04-23 21:34:42 +02:00
bors
7a870aef1a Auto merge of #10432 - samueltardieu:issue-10430, r=Manishearth
New lint: detect `if` expressions with simple boolean assignments to the same target

Closes #10430

changelog: [`needless_bool_assign`] new lint to detect simple boolean assignment to the same target in `if` branches
2023-04-23 15:47:00 +00:00
Josh Soref
d2061faf9e Spelling
* applying
* binding
* complex
* constituent
* demonstrate
* desugaring
* exact
* expression
* for
* functionalities
* github
* implementation
* infers
* multiple conflicting traits
* mutable
* necessarily
* nightly
* nonexistent
* optional
* parameter
* reassignments
* resources
* substitution
* suggestion
* that
* that array is
* using the

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-23 10:52:27 -04:00
bors
e1f6305ecf Auto merge of #10704 - matthiaskrgr:splitest, r=llogiq
split test into 2

changelog: none
2023-04-23 13:44:57 +00:00
bors
496c11005c Auto merge of #10679 - y21:better-const-ctx-check, r=Jarcho
use `is_inside_const_context` for `in_constant` util fn

Fixes #10452.

This PR improves the `in_constant` util function to detect more cases of const contexts. Previously this function would not detect cases like expressions in array length position or expression in an inline const block `const { .. }`.

changelog: [`bool_to_int_with_if`]: recognize array length operand as being in a const context and don't suggest `usize::from` there
2023-04-23 13:33:51 +00:00
bors
316d83a4d8 Auto merge of #10670 - lukaslueg:issue10634, r=Jarcho
Don't suggest `suboptimal_flops` unavailable in nostd

Fixes #10634

changelog: Enhancement: [`suboptimal_flops`]: Do not suggest `{f32,f64}::abs()` or `{f32,f64}::mul_add()` in a `no_std`-environment.
2023-04-23 13:23:48 +00:00
Matthias Krüger
572eecd267 split test into 2 2023-04-23 15:11:31 +02:00
Samuel Tardieu
69da902f41 Detect if expressions with boolean assignments to the same target 2023-04-23 13:44:49 +02:00
bors
f16bfa478f Auto merge of #10703 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-04-23 11:07:14 +00:00
bors
a3ed905928 Auto merge of #10578 - blyxyas:items_after_test_module, r=dswij
Add `items_after_test_module` lint

Resolves task *3* of #10506, alongside *1* resolved at #10543 in an effort to help standarize a little bit more testing modules.

---

changelog:[`items_after_test_module`]: Added the lint.
2023-04-23 10:56:50 +00:00
blyxyas
acf50a7dc6
Improve the help message + add a help span 2023-04-23 12:52:45 +02:00
Philipp Krones
36bf3ef004
Fix dogfood test 2023-04-23 03:44:24 -07:00
Philipp Krones
583c97e9bb
Merge remote-tracking branch 'upstream/master' into rustup 2023-04-23 03:39:03 -07:00
bors
419552227f Auto merge of #10701 - blyxyas:fix-fp-let_underscore_untyped, r=llogiq
Bugfix: Ignore `impl Trait`(s) @ `let_underscore_untyped`

Fixes #10411

changelog:[`let_underscore_untyped`]: Ignore `impl Trait`(s) that caused false positives.
2023-04-23 10:13:41 +00:00
blyxyas
bdd05456b1
Ignore impl Trait(s) 2023-04-23 12:09:36 +02:00
bors
6328371d24 Auto merge of #10681 - J-ZhengLi:issue10529, r=flip1995
make [`len_zero`] lint not spanning over parenthesis

sorry it should be a quick fix but I was caught up by other stuffs last couple weeks 🤦‍♂️

---

fixes: #10529

changelog: make [`len_zero`] lint not spanning over parenthesis
2023-04-23 09:50:16 +00:00
Renato Lochetti
628605e07a
Ignore shadow warns in code from macro expansions 2023-04-22 20:28:08 +01:00
blyxyas
1ac8dc51bc
Compact emmited lint 2023-04-22 21:12:55 +02:00
blyxyas
0354cee137
Add lint items_after_test_module 2023-04-22 21:12:45 +02:00
Alex Macleod
397f36a78c Fix #[allow(clippy::enum_variant_names)] directly on variants 2023-04-22 14:53:15 +00:00
Camille GILLOT
cb3e0fbb59 Evaluate place expression in PlaceMention. 2023-04-21 21:34:59 +00:00
Centri3
85d7de25a9 fix false positive 2023-04-21 05:12:14 -05:00
J-ZhengLi
b8d6964bce
make [len_zero] lint not spanning over parenthesis 2023-04-21 16:56:17 +08:00
y21
654d12ff89 use is_inside_const_context query for in_constant 2023-04-20 22:43:59 +02:00
bors
06dace2920 Auto merge of #10669 - oli-obk:@, r=Alexendoo
Update to a compiletest-rs version that requires `//@` for commands

Requires https://github.com/Manishearth/compiletest-rs/pull/261 to get published

This PR is a smaller step towards https://github.com/rust-lang/rust-clippy/pull/10426

changelog: Move to a version of compiletest-rs that allows us to require `//`@`` for test suite commands.
2023-04-20 14:51:33 +00:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
Centri3
a3aeec4f75 config instead of new lint and don't panic 2023-04-19 21:46:13 -05:00
Lukas Lueg
2745c87842 Dont suggest suboptimal_flops unavailable in nostd
Fixes #10634
2023-04-19 20:04:17 +02:00
Caio
3db7352b81 [arithmetic_side_effects] Fix #10590 2023-04-19 10:58:00 -03:00