Commit Graph

18879 Commits

Author SHA1 Message Date
bors
ca7b54b085 Auto merge of #11945 - adamreichold:fix-lint-comments, r=Alexendoo
Try to improve wording and fix dead link in description of arc_with_non_send_sync lint.

changelog: [`arc_with_non_send_sync`]: Improve wording and fix dead link.
2024-01-16 19:43:39 +00:00
Michael Goulet
f7376a0f8c Deal with additional wrapping of async closure body in clippy 2024-01-16 17:12:10 +00:00
Guillaume Gomez
7217c22f69 Update trait_duplication_in_bounds.rs ui test to add regression for ##9961 2024-01-16 12:13:27 +01:00
Guillaume Gomez
169e2ab55b Correctly handle type relative in trait_duplication_in_bounds lint 2024-01-16 12:13:27 +01:00
bors
ecb0311fcc Auto merge of #12149 - GuillaumeGomez:core-std-suggestions, r=llogiq
Correctly suggest std or core path depending if this is a `no_std` crate

A few lints emit suggestions using `std` paths whether or not this is a `no_std` crate, which is an issue when running `rustfix` afterwards. So in case this is an item that is defined in both `std` and `core`, we need to check if the crate is `no_std` to emit the right path.

r? `@llogiq`

changelog: Correctly suggest std or core path depending if this is a `no_std` crate
2024-01-16 06:26:29 +00:00
Guillaume Gomez
136a582349 Add non_exhaustive checks in derive_partial_eq_without_eq.rs ui test 2024-01-15 23:29:06 +01:00
Guillaume Gomez
a1989046c1 Don't emit derive_partial_eq_without_eq lint if the type has the non_exhaustive attribute 2024-01-15 23:29:06 +01:00
Guillaume Gomez
874f851ac5 Use std_or_core instead of doing check by hand every time 2024-01-15 20:53:00 +01:00
Martin Nordholts
6a74a0e17b compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-15 19:07:11 +01:00
bors
771a2a965c Auto merge of #11926 - edmorley:update-default-doc_valid_idents, r=blyxyas
Add "OpenTelemetry" to default `doc_valid_idents`

The OpenTelemetry project's name is all one word (see https://opentelemetry.io), so currently triggers a false positive in the `doc_markdown` lint.

The project is increasing rapidly in popularity, so it seems like a worthy contender for inclusion in the default `doc_valid_idents` configuration.

I've also moved the existing "OpenDNS" entry earlier in the list, to restore the alphabetical ordering of that "Open*" row.

The docs changes were generated using `cargo collect-metadata`.

changelog: [`doc_markdown`]: Add `OpenTelemetry` to the default configuration as an allowed identifier
2024-01-15 17:38:44 +00:00
Samuel Moelius
ad2a2ba94d Ensure callee_ids are body owners 2024-01-15 12:26:45 -05:00
y21
f09cd88199
fix false positive in suspicious_open_options, make paths work 2024-01-15 17:15:09 +00:00
atwam
515fe65ba8
Fix conflicts
- New ineffective_open_options had to be fixed.
- Now not raising an issue on missing `truncate` when `append(true)`
  makes the intent clear.
- Try implementing more advanced tests for non-chained operations. Fail
2024-01-15 17:15:09 +00:00
atwam
84588a8815
Add suggestion/fix to suspicious_open_options
Also rebase and fix conflicts
2024-01-15 17:15:09 +00:00
atwam
2ec8729962
PR Fixes 2024-01-15 17:15:08 +00:00
atwam
6fb471d646
More helpful text, small style changes. 2024-01-15 17:15:08 +00:00
atwam
6c201db005
Add suspicious_open_options lint.
Checks for the suspicious use of OpenOptions::create()
without an explicit OpenOptions::truncate().

create() alone will either create a new file or open an
existing file. If the file already exists, it will be
overwritten when written to, but the file will not be
truncated by default. If less data is written to the file
than it already contains, the remainder of the file will
remain unchanged, and the end of the file will contain old
data.
In most cases, one should either use `create_new` to ensure
the file is created from scratch, or ensure `truncate` is
called so that the truncation behaviour is explicit.
`truncate(true)` will ensure the file is entirely overwritten
with new data, whereas `truncate(false)` will explicitely
keep the default behavior.

```rust
use std::fs::OpenOptions;

OpenOptions::new().create(true).truncate(true);
```
2024-01-15 17:15:08 +00:00
Ed Morley
a16a85030c
Add "OpenTelemetry" to default doc_valid_idents
The OpenTelemetry project's name is all one word (see https://opentelemetry.io),
so currently triggers a false positive in the `doc_markdown` lint.

The project is increasing rapidly in popularity, so it seems like a worthy
contender for inclusion in the default `doc_valid_idents` configuration.

I've also moved the existing "OpenDNS" entry earlier in the list, to restore
the alphabetical ordering of that "Open*" row.

The docs changes were generated using `cargo collect-metadata`.

changelog: [`doc_markdown`]: Add `OpenTelemetry` to the default configuration as an allowed identifier
2024-01-15 14:26:41 +00:00
Adam Reichold
33d8e47e98
Try to improve wording and fix dead link in description of arc_with_non_send_sync lint. 2024-01-15 09:07:48 +01:00
bors
692f53fe8f Auto merge of #12136 - y21:issue12135, r=Jarcho
[`useless_asref`]: check that the clone receiver is the parameter

Fixes #12135

There was no check for the receiver of the `clone` call in the map closure. This makes sure that it's a path to the parameter.

changelog: [`useless_asref`]: check that the clone receiver is the closure parameter
2024-01-15 05:08:16 +00:00
bors
d6ff2d2c2d Auto merge of #12141 - samueltardieu:issue-12138, r=Jarcho
from_over_into: suggest a correct conversion to ()

changelog: [`from_over_into`]: suggest a correct conversion to `()`

Fix #12138
2024-01-15 04:32:22 +00:00
bors
37b8ae7f17 Auto merge of #12114 - talagrand:patch-1, r=Jarcho
['arc_with_non_send_sync`] documentation edits

Arc's documentation uses the term "thread"; aligning to that terminology. Fix casing of "Rc".

changelog: None
2024-01-15 04:21:37 +00:00
bors
a9fa2f5ed1 Auto merge of #12074 - ARandomDev99:12044-include-comments-while-checking-duplicate-code, r=Jarcho
Make `HirEqInterExpr::eq_block` take comments into account while checking if two blocks are equal

This PR:
- now makes `HirEqInterExpr::eq_block` take comments into account. Identical code with varying comments will no longer be considered equal.
- makes necessary adjustments to UI tests.

Closes #12044

**Lintcheck Changes**
- `match_same_arms` 53 => 52
- `if_same_then_else` 3 => 0

changelog: [`if_same_then_else`]: Blocks with different comments will no longer trigger this lint.
changelog: [`match_same_arms`]: Arms with different comments will no longer trigger this lint.
```
2024-01-15 04:06:52 +00:00
Kristof Mattei
e8ec99811b
fix: crates are limited to ASCII values 2024-01-14 14:00:13 -07:00
Kristof Mattei
ea585ef321
chore: remove unneeded into_iter 2024-01-14 09:40:14 -07:00
Kristof Mattei
b1c52d502d
chore: add comments to explain reasoning 2024-01-14 09:32:36 -07:00
Kristof Mattei
5d06fbb46d
fix: don't allocate new string when not needed 2024-01-14 09:25:31 -07:00
Guillaume Gomez
40a45a463f Update and add ui tests for core/std suggestions 2024-01-14 14:45:24 +01:00
Guillaume Gomez
1bcaf29e0b Correctly suggest std or core path depending if this is a no_std crate 2024-01-14 14:45:24 +01:00
y21
0774489086 find function path references early in the lint pass 2024-01-14 06:12:15 +01:00
Kristof Mattei
d975e267b9
fix: add fix for bug, fix test name 2024-01-13 17:44:27 -07:00
Kristof Mattei
5769c21f23
chore: negative test for multiple crate versions not working when name contains dashes 2024-01-13 17:27:43 -07:00
blyxyas
44f5d969d5
Change PublicallyExported -> PubliclyExported 2024-01-14 01:14:05 +01:00
blyxyas
2469784cb6
Add . to end of lint lists in configuration 2024-01-14 01:06:35 +01:00
y21
be5707ce1b lint on .map(|&x| x.clone()) 2024-01-13 17:46:46 +01:00
Samuel Tardieu
e025356969 from_over_into: suggest a correct conversion to () 2024-01-13 13:19:55 +01:00
bors
5a45dbe2e6 Auto merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnr
Delegation implementation: step 1

See https://github.com/rust-lang/rust/issues/118212 for more details.

r? `@petrochenkov`
2024-01-13 04:19:17 +00:00
bors
a71211d0b5 Auto merge of #12140 - GuillaumeGomez:improve-message-search_is_some, r=llogiq
Improve help message for `search_is_some` lint

Fixes #11681.

Like mentioned in the issue, we tend to use the formulation "consider using", which we didn't in this case. I think it clears both the confusion and also makes help message more coherent overall.

r? `@llogiq`

changelog: Improve help message for `search_is_some` lint
2024-01-12 23:48:39 +00:00
Nilstrieb
3b7ba1d10a Improve let_underscore_lock
- lint if the lock was in a nested pattern
- lint if the lock is inside a `Result<Lock, _>`
2024-01-12 23:18:58 +01:00
Guillaume Gomez
37947ffc40 Update ui tests for search_is_some lint 2024-01-12 22:48:30 +01:00
Guillaume Gomez
68aceeed03 Improve help message for search_is_some lint 2024-01-12 22:48:30 +01:00
bors
7eca5afd34 Auto merge of #12137 - GuillaumeGomez:fix-unconditional_recursion-false-positive, r=llogiq
Fix false positive in `PartialEq` check in `unconditional_recursion` lint

Fixes https://github.com/rust-lang/rust-clippy/issues/12133.

We needed to check for the type of the previous element <del>in case it's a field</del>.

EDIT: After some extra thoughts, no need to check if it's a field, just if it's the same type as `Self`.

r? `@llogiq`

changelog: Fix false positive in `PartialEq` check in `unconditional_recursion` lint
2024-01-12 18:30:11 +00:00
Guillaume Gomez
132667288a Add regression ui test for unconditional_recursion lint on PartialEq 2024-01-12 17:37:09 +01:00
Guillaume Gomez
c8cd09a8e6 Fix false positive in PartialEq check in unconditional_recursion lint 2024-01-12 17:37:09 +01:00
Guillaume Gomez
e9f87132a1 Rollup merge of #119819 - chenyukang:yukang-fix-118183-lint, r=davidtwco
Check rust lints when an unknown lint is detected

Fixes #118183
2024-01-12 15:16:56 +01:00
y21
153b83f61b [useless_asref]: check that the clone receiver is the local 2024-01-12 13:39:42 +01:00
Bryanskiy
09d024117e Delegation implementation: step 1 2024-01-12 14:11:16 +03:00
yukang
1485e5c4da check rust lints when an unknown lint is detected 2024-01-12 18:50:36 +08:00
bors
88b5d519a1 Auto merge of #12129 - GuillaumeGomez:map-clone-copy, r=llogiq
Fix suggestion for `map_clone` lint on types implementing `Copy`

Follow-up of https://github.com/rust-lang/rust-clippy/pull/12104.

It was missing this check to suggest the correct method.

r? `@llogiq`

changelog: Fix suggestion for `map_clone` lint on types implementing `Copy`
2024-01-11 23:28:12 +00:00
bors
c5371342c2 Auto merge of #12132 - blyxyas:not-on-vacation-again, r=xFrednet
I'm not on vacation (again)

A few weeks ago I opened #12011 removing me from `users_on_vacation`, it got merged. The subtree sync reverted this change (weirdly)

changelog: none

r? `@xFrednet`
2024-01-11 20:20:32 +00:00