Commit graph

15916 commits

Author SHA1 Message Date
bors d29c4c9f63 Auto merge of #10174 - chansuke:hotfix/remove-paths, r=dswij
hotfix: remove `ITER_COUNT` since it is not called

`&paths:ITER_COUNT` is not being called from anywhere, so removing it doesn't seem to be a problem.

---

changelog: none
2023-01-08 16:27:41 +00:00
chansuke d8877bbd8a hotfix: remove ITER_COUNT since it is not called 2023-01-07 22:57:30 +09:00
bors cf1d3d0370 Auto merge of #10162 - tamaroning:fix10018, r=xFrednet
Fix FP of single-element-loop

closes #10018

---

changelog: [`single_element_loop`]: No longer lints, if the loop contains a `break` or `continue`
[#10162](https://github.com/rust-lang/rust-clippy/pull/10162)
<!-- changelog_checked -->
2023-01-07 11:53:45 +00:00
Raiki Tamura ce56cf71d9 chore 2023-01-07 20:44:02 +09:00
bors ef5a545f98 Auto merge of #10164 - khuey:default_enum_unit_variant_msrv, r=llogiq
Restrict suggestion of deriving Default for enums to MSRV 1.62.

See https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html#default-enum-variants

---

changelog: none
2023-01-07 00:28:00 +00:00
bors 19b79c485e Auto merge of #10168 - blyxyas:fix_reversed_empty_ranges, r=dswij
[#10167] Clarify that the lint only works if x eq. y in a `for` loop.

Reading the documentation for the lint, one could expect that the lint works in all cases that `X == Y`. This is false.

While the lint was updated, the documentation wasn't.

More information about the `N..N` problem in #5689 and #5628

---

Fixes #10167
changelog: [`reversed_empty_ranges`]: Update and clarify documentation
2023-01-06 18:55:20 +00:00
bors 3f0d0c1be7 Auto merge of #10112 - c410-f3r:arith, r=xFrednet
[arithmetic-side-effects] Consider negative numbers and add more tests

Same as #9867.

Opening again because it is not possible to randomly choose a reviewer in an ongoing PR like in the rust repo.

---

changelog: PF: [`arithmetic_side_effects`]: No longer lints on corner cases with negative number literals
[#9867](https://github.com/rust-lang/rust-clippy/pull/9867)
<!-- changelog_checked -->
2023-01-06 15:54:36 +00:00
Caio 4262aebeaa [arithmetic-side-effects] Consider negative numbers and add more tests 2023-01-06 12:25:51 -03:00
blyxyas 1b9a25e28d
[#10167] Clarify that the lint only works if x eq. y in a for loop.
Reading the documentation for the lint, one could expect that the lint works in all cases that `X == Y`. This is false.

While the lint was updated, the documentation wasn't.

More information about the `N..N` problem in #5689 and #5628
2023-01-06 14:41:50 +01:00
bors 179a22f624 Auto merge of #10153 - llogiq:box-default-trim-paths, r=Jarcho
trim paths in `box_default`

This might help with #10089, though I have not tested that yet. In any event, it keeps the suggestion short and to the point.

---
changelog: Trim paths in [`box_default`] suggestion
2023-01-06 09:21:27 +00:00
bors 3f48ed523f Auto merge of #10160 - llogiq:default-trim-paths, r=dswij
trim paths in `default_trait_access`/`clone_on_copy` suggestions

This should help making the suggestions more palatable. Similar to #10153.

---

changelog: trim paths in [`default_trait_access`]/[`clone_on_copy`] suggestions
2023-01-06 09:07:58 +00:00
bors 3816f9a6f9 Auto merge of #10137 - euclio:dbg-macro, r=giraffate
reword dbg_macro labels

---

This change rewords the `dbg_macro` lint labels to be clearer.

changelog: none
<!-- changelog_checked -->
2023-01-06 05:25:34 +00:00
bors 4f4c96155a Auto merge of #10142 - EricWu2003:drop_ref-FP, r=llogiq
[`drop_ref`]: don't lint idiomatic in match arm

fixes #10122

As established in issue #9482, it is idiomatic to use a single `drop()` expression in a match arm to achieve a side-effect of a function while discarding its output. This should also apply to cases where the function returns a reference.

The change to the lint's code was less than 1 line, because all the heavy lifting was done in PR #9491.

---

changelog: FP: [`drop_ref`]: No longer lints idiomatic expression in `match` arms
[#10142](https://github.com/rust-lang/rust-clippy/pull/10142)
<!-- changelog_checked -->
2023-01-05 23:36:49 +00:00
Kyle Huey 6433d796a1 Restrict suggestion of deriving Default for enums to MSRV 1.62.
See https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html#default-enum-variants
2023-01-05 13:06:43 -08:00
Raiki Tamura 79ed23ff81 fix 2023-01-05 18:30:13 +09:00
bors 61ff54e5c2 Auto merge of #10161 - khuey:default_enum_unit_variant, r=llogiq
Expand derivable-impls to cover enums with a default unit variant.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`derivable_impls`]: suggest deriving Default for enums with a default unit variant
2023-01-05 06:57:05 +00:00
Kyle Huey 1c42dbba60 Expand derivable-impls to cover enums with a default unit variant. 2023-01-04 19:08:37 -08:00
bors d5d8ef13d7 Auto merge of #10159 - khuey:iter_kv_map_ref_mut, r=llogiq
Make the iter_kv_map lint handle ref/mut annotations.

For the degenerate (`map(|(k, _)| k)`/`map(|(_, v)| v)`) cases a mut annotation is superfluous and a ref annotation won't compile, so no additional handling is required. For cases where the `map` call must be preserved ref/mut annotations should also be presereved so that the map body continues to work as expected.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`iter_kv_map`]: handle ref/mut annotations
2023-01-04 23:13:39 +00:00
Kyle Huey 755ae3fa29 Fix spelling while we're in the neighborhood. 2023-01-04 14:58:07 -08:00
Andre Bogus 05ba519a3a trim paths in default_trait_access/clone_on_copy suggestions 2023-01-04 23:39:46 +01:00
Kyle Huey d0c1605d51 Make the iter_kv_map lint handle ref/mut annotations.
For the degenerate (`map(|(k, _)| k)`/`map(|(_, v)| v)`) cases a mut annotation is superfluous and a ref annotation won't compile, so no additional handling is required. For cases where the `map` call must be preserved ref/mut annotations should also be presereved so that the map body continues to work as expected.
2023-01-04 13:32:34 -08:00
bors d39dd869a5 Auto merge of #10140 - chansuke:chore/add-comment-for-enclosing-block, r=Alexendoo
chore: add simple comment for `get_enclosing_block`

I was reading the code of `clippy_utils/src/lib.rs` and thought that adding comment on `get_closing_block` would be helpful to first time visitor.

---

changelog: none
<!-- changelog_checked -->
2023-01-04 20:52:31 +00:00
bors a385d34fc2 Auto merge of #10107 - tylerjw:suggest_path, r=Alexendoo
Suggest using Path for comparing extensions

fixes #10042

changelog: Sugg: [`case_sensitive_file_extension_comparisons`]: Now displays a suggestion with `Path`
[#10107](https://github.com/rust-lang/rust-clippy/pull/10107)
<!-- changelog_checked -->
2023-01-04 19:27:11 +00:00
Tyler Weaver ea6ff7ed04
Apply changes suggested in review 2023-01-04 07:06:07 -07:00
Andre Bogus d3a50d2fda trim paths in box_default 2023-01-04 00:44:20 +01:00
bors 0bca8dd254 Auto merge of #10135 - ardislu:fix-typo, r=giraffate
Fix typo in installation instructions

changelog: none
<!-- changelog_checked -->
2023-01-03 14:17:55 +00:00
bors 8b1ac4539d Auto merge of #10141 - FoseFx:fosefx/9887, r=Jarcho
fix empty_structs_with_brackets suggestion errors

fixes #9887

I refer to [my comment](https://github.com/rust-lang/rust-clippy/issues/9887#issuecomment-1368495395) to explain this PR.

---

changelog: Sugg: [`empty_structs_with_brackets`]: The suggestion is no longer machine applicable, to avoid errors when accessing struct fields
[#10141](https://github.com/rust-lang/rust-clippy/pull/10141)
<!-- changelog_checked -->
2023-01-03 03:57:19 +00:00
bors 43349195f7 Auto merge of #10143 - EricWu2003:field_reassign_with_default-FP, r=Manishearth
don't lint field_reassign when field in closure

fixes #10136

This change makes the ContainsName struct visit all interior expressions, which means that ContainsName will return true even if `name` is used in a closure within `expr`.

---

changelog: FP: [`field_reassign_with_default`]: No longer lints cases, where values are initializes from closures capturing struct values
[#10143](https://github.com/rust-lang/rust-clippy/pull/10143)
<!-- changelog_checked -->
2023-01-03 03:16:18 +00:00
Tyler Weaver 0cee2c5095
Don't trigger lint if last method is to_lower/upper 2023-01-02 16:42:56 -07:00
Eric Wu cf4e9813b0 use OnlyBodies instead of All
we only need to check closures, so
nestedfilter::All was overkill here.
2023-01-02 18:35:21 -05:00
Tyler Weaver 0aa7d73df3
Only remove method from end of recv, indent suggestion source
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-02 16:27:46 -07:00
Tyler Weaver bd83650e91
Suggest using Path for comparing extensions
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-02 16:27:46 -07:00
bors 1a46dc0b9f Auto merge of #10138 - smoelius:unused_self-typo, r=xFrednet
Fix typo in `unused_self` diagnostic message

changelog: Msg: [`unused_self`]: The message now correctly uses *an*
[#10138](https://github.com/rust-lang/rust-clippy/pull/10138)
<!-- changelog_checked -->
2023-01-02 22:57:27 +00:00
bors 653f5d98d8 Auto merge of #10139 - chansuke:chore/fix-if_chain_ident, r=Jarcho
chore: fix identation of `if_chain` in `filter_map`

This is a really small fix.
If someone could take a look at it, I would appreciate it🙏

---

changelog: none
<!-- changelog_checked -->
2023-01-02 22:44:15 +00:00
bors 3006c7cd4f Auto merge of #10146 - Nilstrieb:💀, r=llogiq
Correct Gankra's name in the linkedlist lint

changelog: [`linkedlist`]: Update description
2023-01-02 20:14:21 +00:00
Nilstrieb f53c6e2f15 Correct Gankra's name in the linkedlist lint 2023-01-02 19:58:00 +01:00
Andy Russell 9aef1a264a
reword dbg_macro labels 2023-01-02 12:09:26 -05:00
Max Baumann 7a1a9c8188
empty_structs_with_brackets: not MachineApplicable anymore 2023-01-02 14:58:10 +01:00
Eric Wu 01a2a9df43 [drop_ref]: don't lint idiomatic in match arm 2023-01-01 22:33:18 -05:00
Eric Wu 8de011fdf7 don't lint field_reassign when field in closure
This commit makes the ContainsName struct visit all interior
expressions, which means that ContainsName will return true
even if `name` is used in a closure within `expr`.
2023-01-01 21:41:46 -05:00
chansuke 6145194b68 chore: add simple comment for get_enclosing_block 2023-01-02 00:18:03 +09:00
chansuke 5b46f2db59 chore: fix identation of if_chain in filter_map 2023-01-02 00:17:52 +09:00
bors a85e480dd1 Auto merge of #10110 - Niki4tap:needless_anyhow_return, r=Alexendoo
Fix FN in `needless_return`

Fixes #10051

changelog: Enhancement: [`needless_return`]: Now detects more cases for returns of owned values
[#10110](https://github.com/rust-lang/rust-clippy/pull/10110)
<!-- changelog_checked -->
2023-01-01 13:55:29 +00:00
Samuel Moelius da7c99b81e Fix typo in unused_self diagnostic message 2023-01-01 06:21:28 -05:00
Ardis Lu 7a64a51818
Fix typo 2022-12-31 02:14:20 -08:00
bors 6ccd4ebd5b Auto merge of #10115 - rdrpenguin04:master, r=flip1995
Move `mutex_atomic` to `restriction`

By #4295, the general consensus seems to be that `mutex_atomic` is not a useful lint in most cases. If anything, it could be useful as a restriction on code that for whatever reason can't use atomics. Keeping it in `clippy::nursery` is harmful to people attempting to use clippy for soundness.

---

changelog: Moved [`mutex_atomic`] to `restriction`
[#10115](https://github.com/rust-lang/rust-clippy/pull/10115)
<!-- chnagelog_checked -->
2022-12-30 15:49:12 +00:00
Ray Redondo 0298095ac2 add comment about mutex_atomic issue to description 2022-12-29 14:48:36 -06:00
bors 4f3ab69ea0 Auto merge of #10126 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

Love this time of the year. No conflicts, because no one merges anything.

changelog: none
2022-12-29 13:26:43 +00:00
Philipp Krones 1f971866d1
Bump nightly version -> 2022-12-29 2022-12-29 14:24:44 +01:00
Philipp Krones 08535408e8
Merge remote-tracking branch 'upstream/master' into rustup 2022-12-29 14:24:30 +01:00