Commit graph

21361 commits

Author SHA1 Message Date
lapla-cogito
08d8c4a67f
don't suggest to use cloned for Cow in unnecessary_to_owned 2024-12-27 21:11:25 +09:00
Philipp Krones
609cd310be
Rustup (#13881)
r? @ghost

changelog: none
2024-12-26 13:52:31 +00:00
Philipp Krones
416f7e84c0
Bump nightly version -> 2024-12-26 2024-12-26 14:47:30 +01:00
Philipp Krones
14af404672
Merge remote-tracking branch 'upstream/master' into rustup 2024-12-26 14:46:57 +01:00
Philipp Krones
dff0294ab3
fix examples using Ty.kind() in the book (#13875)
`Ty.kind()` is a method.

changelog: none
2024-12-26 12:31:32 +00:00
lapla-cogito
b28bfbceeb
fix examples using Ty.kind() 2024-12-25 13:59:48 +09:00
llogiq
85b609419b
auto-fix if_not_else (#13809)
fix #13411

The `if_not_else` lint can be fixed automatically, but the issue above
reports that there is no implementation to do so. Therefore, this PR
implements it.

----

changelog: [`if_not_else`]: make suggestions for modified code
2024-12-24 21:45:42 +00:00
lapla-cogito
887aa269b6
add more tests 2024-12-24 21:10:43 +09:00
bors
b5fe6ec47b Auto merge of #134625 - compiler-errors:unsafe-binders-ty, r=oli-obk
Begin to implement type system layer of unsafe binders

Mostly TODOs, but there's a lot of match arms that are basically just noops so I wanted to split these out before I put up the MIR lowering/projection part of this logic.

r? oli-obk

Tracking:

- https://github.com/rust-lang/rust/issues/130516
2024-12-24 00:51:51 +00:00
Alejandra González
988042e0b2
chore: multipart suggestions for let_unit_value lint (#13754)
This should address #13099 for the let_unit test.

changelog: [let_unit]: Updated let_unit to use multipart_suggestions
where appropriate
2024-12-23 14:50:01 +00:00
Timo
592fd34c1b
Fix has_iter_method documentation (#13867)
changelog: none
2024-12-23 02:21:16 +00:00
Samuel Tardieu
1f8ba334a5 Fix has_iter_method documentation 2024-12-23 00:42:34 +01:00
Michael Goulet
4d735d831e Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
Scott McMurray
c772140a1f Update clippy 2024-12-22 06:12:45 -08:00
llogiq
b3fadd5a8e
Add allow-indexing-slicing-in-tests option (#13854)
Close #13842

changelog: [`indexing_slicing`]: add allow-indexing-slicing-in-tests
option to be able ignore at test
2024-12-19 20:11:48 +00:00
Alexey Semenyuk
6f6ddd299c Add allow-indexing-slicing-in-tests option 2024-12-20 01:06:49 +05:00
bors
54a396a9bd Auto merge of #133961 - lcnr:borrowck-cleanup, r=jackh726
cleanup region handling: add `LateParamRegionKind`

The second commit is to enable a split between `BoundRegionKind` and `LateParamRegionKind`, by avoiding `BoundRegionKind` where it isn't necessary.

The third comment then adds `LateParamRegionKind` to avoid having the same late-param region for separate bound regions. This fixes #124021.

r? `@compiler-errors`
2024-12-19 08:33:20 +00:00
Manish Goregaokar
a775a1b41f
Use multipart suggestion in unnecessary_to_owned (#13847)
It is related to https://github.com/rust-lang/rust-clippy/issues/13099

What was done:
- removed `@no-rustfix` from `tests/ui/unnecessary_to_owned.rs`
- checked for suggestions in `src/methods/unnecessary_to_owned.rs`
(there is already one multipart_suggestion, and I don't see any other)
- ran `cargo uibless`

I am new to Rust, and this is my first PR.

changelog: none
2024-12-19 01:25:29 +00:00
Oleksandr Polieno
1e0b59d6a6 Use multipart suggestion in unnecessary_to_owned 2024-12-19 07:29:18 +07:00
lcnr
f415510fba introduce LateParamRegionKind 2024-12-18 16:05:44 +01:00
许杰友 Jieyou Xu (Joe)
550d36d895 Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino
Overhaul token cursors

Some nice cleanups here.

r? `````@davidtwco`````
2024-12-18 22:56:53 +08:00
Alejandra González
9f4941a873
chore: starting to fix unnecessary_iter_cloned (#13848)
This will address https://github.com/rust-lang/rust-clippy/issues/13099
for the unnecessary_iter_cloned test.

changelog: [unnecessary_iter_cloned]: unnecessary_iter_cloned
manual_assert to use multipart_suggestions where appropriate
2024-12-17 23:48:16 +00:00
Nicholas Nethercote
1cb4dcafd1 Rename RefTokenTreeCursor.
Because `TokenStreamIter` is a much better name for a `TokenStream`
iterator. Also rename the `TokenStream::trees` method as
`TokenStream::iter`, and some local variables.
2024-12-18 10:39:07 +11:00
Nicholas Nethercote
5c200c2255 Simplify RefTokenTreeCursor::look_ahead.
It's only ever used with a lookahead of 0, so this commit removes the
lookahead and renames it `peek`.
2024-12-18 10:31:39 +11:00
Philipp Krones
8ea395ed14
fix a broken anchor in the book (#13846)
changelog: none
2024-12-17 21:37:59 +00:00
Philipp Krones
f8da18cdef
Do not mark attributes with unknown namespace as useless (#13766)
Fixes #13764

changelog: [`useless_attribute`]: do not trigger on attributes with
unknown namespace
2024-12-17 21:37:10 +00:00
Scott Gerring
8fe39b276f Change unnecessary_iter_cloned to use multipart_suggestion 2024-12-17 18:14:34 +01:00
Jason Newcomb
0f9cc8d58b
Don't trigger filter_map_identity with an iterator from an empty array (#13826)
fix #12653

changelog: [`filter_map_identity`]: don't lint for creating an iterator
from an empty array
2024-12-17 13:34:04 +00:00
lapla-cogito
81c0cf8a2d
fix the team anchor in book 2024-12-17 21:53:50 +09:00
Jonathan Dönszelmann
4d05825f3e rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structures 2024-12-16 19:08:19 +01:00
Jonathan Dönszelmann
6f65a813a2 split attributes 2024-12-16 19:08:19 +01:00
Philipp Krones
77c9dddecb
Correctly handle string indices in literal_string_with_formatting_arg (#13841)
Fixes https://github.com/rust-lang/rust-clippy/issues/13838.

r? @klensy

changelog: Correctly handle string indices in
`literal_string_with_formatting_arg`
2024-12-16 16:22:27 +00:00
Guillaume Gomez
ad695da7d2 Correctly handle string indices in literal_string_with_formatting_arg 2024-12-16 17:06:22 +01:00
llogiq
063c5c1743
correct suggestion for unnecessary_sort_by in no_std (#13836)
fix #11524

In a `no_std` environment, we can use `core::cmp::Reverse` instead of
`std::cmp::Reverse`.

----

changelog: [`unnecessary_sort_by`]: correct suggestion in `no_std`
2024-12-16 15:48:56 +00:00
lapla-cogito
1a23b5b517
correct suggestion for unnecessary_sort_by in no_std 2024-12-16 18:07:47 +09:00
llogiq
968669b00a
Do not suggest using Error in no_std before Rust 1.81 (#13834)
changelog: [`result_unit_err`]: do not suggest using `Error` in `no_std`
mode before Rust 1.81

Fix #9767
2024-12-16 05:15:20 +00:00
Alex Macleod
8da8da8428
Initial impl of repr_packed_without_abi (#13398)
Fixes #13375

I've added the lint next to the other attribute-related ones. Not sure
if this is the correct place, since while we are looking after the
`packed`-attribute (there is nothing we can do about types defined
elsewhere), we are more concerned about the type's representation set by
the attribute (instead of "duplicate attributes" and such).

The lint simply looks at the attributes themselves without concern for
the item-kind, since items where `repr` is not allowed end up in a
compile-error anyway.

I'm somewhat concerned about the level of noise this lint would cause
if/when it goes into stable, although it does _not_ come up in
`lintcheck`.

```
changelog: [`repr_packed_without_abi`]: Initial implementation
```
2024-12-16 02:17:59 +00:00
Samuel Tardieu
4c0177cbbc Do not suggest using Error in no_std before Rust 1.81 2024-12-16 00:40:50 +01:00
Timo
60dbda209e
fix typo in numeric_arithmetic logic (#13820)
Looks like typo for me.

Looking at blame
b76b0aeb63 (diff-ac15e787d7d276b24f251f4f5bdedf1e6ac81aa1e2ea0db27219e9a7fa8b0b30L66)
the same typo was before.

Is logic here actually correct? Tests passed locally, but i expected
some changes.

changelog: none
2024-12-15 20:50:02 +00:00
Lukas Lueg
7a80f7b790 Initial impl repr_packed_without_abi
Fixes #13375
2024-12-15 20:36:47 +01:00
Jonathan Dönszelmann
6dfa37f02a Add hir::Attribute 2024-12-15 19:18:46 +01:00
Oli Scherer
f332026bc7 Rename value field to expr to simplify later commits' diffs 2024-12-15 18:47:45 +01:00
Alejandra González
b8e569e9c0
chore: use multipart_suggestions for match_same_arms (#13803)
This addresses https://github.com/rust-lang/rust-clippy/issues/13099 for
the match_same_arms lint.

changelog: [match_same_arms]: Updated match_same_arms to use
multipart_suggestions where appropriate
2024-12-15 17:35:47 +00:00
llogiq
f1f1165053
fix must_use_unit suggestion when there're multiple attributes (#13830)
fix #12320

When there're multiple attributes, clippy suggests leaving an extra
comma and it makes an error.

changelog: [`must_use_unit`]: No longer make incorrect suggestions when
multiple attributes present.
2024-12-15 17:04:27 +00:00
Philipp Krones
1dddeab7c9
Rustup (#13832)
r? @ghost

changelog: none
2024-12-15 15:55:37 +00:00
Philipp Krones
028d87b018 Bump nightly version -> 2024-12-15 2024-12-15 16:49:23 +01:00
Philipp Krones
12edfb82e5 Merge remote-tracking branch 'upstream/master' into rustup 2024-12-15 16:48:56 +01:00
lapla-cogito
e7c27c6774
correct suggestion for must_use_unit when there are multiple attributes 2024-12-15 20:28:38 +09:00
Stuart Cook
6a92b851f5 Rollup merge of #134285 - oli-obk:push-vwrqsqlwnuxo, r=Urgau
Add some convenience helper methods on `hir::Safety`

Makes a lot of call sites simpler and should make any refactorings needed for https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 simpler, as fewer sites have to be touched in case we end up storing some information in the variants of `hir::Safety`
2024-12-15 20:01:38 +11:00
bors
4cddd0e935 Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkov
Remove support for specializing ToString outside the standard library

This is the only trait specializable outside of the standard library. Before stabilizing specialization we will probably want to remove support for this. It was originally made specializable to allow a more efficient ToString in libproc_macro back when this way the only way to get any data out of a TokenStream. We now support getting individual tokens, so proc macros no longer need to call it as often.
2024-12-15 04:45:24 +00:00