Skip to content

Commit 03a5b6b

Browse files
authored
Rustup (#14721)
r? @ghost changelog: none
2 parents 549107d + 8a91bbf commit 03a5b6b

28 files changed

+112
-89
lines changed

clippy_lints/src/dereference.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl TyCoercionStability {
853853
continue;
854854
},
855855
ty::Param(_) if for_return => Self::Deref,
856-
ty::Alias(ty::Weak | ty::Inherent, _) => unreachable!("should have been normalized away above"),
856+
ty::Alias(ty::Free | ty::Inherent, _) => unreachable!("should have been normalized away above"),
857857
ty::Alias(ty::Projection, _) if !for_return && ty.has_non_region_param() => Self::Reborrow,
858858
ty::Infer(_)
859859
| ty::Error(_)

clippy_lints/src/missing_const_for_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn fn_inputs_has_impl_trait_ty(cx: &LateContext<'_>, def_id: LocalDefId) -> bool
197197
inputs.iter().any(|input| {
198198
matches!(
199199
input.kind(),
200-
ty::Alias(ty::AliasTyKind::Weak, alias_ty) if cx.tcx.type_of(alias_ty.def_id).skip_binder().is_impl_trait()
200+
ty::Alias(ty::AliasTyKind::Free, alias_ty) if cx.tcx.type_of(alias_ty.def_id).skip_binder().is_impl_trait()
201201
)
202202
})
203203
}

clippy_utils/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This crate is only guaranteed to build with this `nightly` toolchain:
88

99
<!-- begin autogenerated nightly -->
1010
```
11-
nightly-2025-04-22
11+
nightly-2025-05-01
1212
```
1313
<!-- end autogenerated nightly -->
1414

clippy_utils/src/hir_utils.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,11 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11171117
self.hash_const_arg(s);
11181118
self.hash_const_arg(e);
11191119
},
1120+
TyPatKind::Or(variants) => {
1121+
for variant in variants {
1122+
self.hash_ty_pat(variant);
1123+
}
1124+
},
11201125
TyPatKind::Err(_) => {},
11211126
}
11221127
}

clippy_utils/src/source.rs

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub trait SpanRangeExt: SpanRange {
142142
map_range(cx.sess().source_map(), self.into_range(), f)
143143
}
144144

145+
#[allow(rustdoc::invalid_rust_codeblocks, reason = "The codeblock is intentionally broken")]
145146
/// Extends the range to include all preceding whitespace characters, unless there
146147
/// are non-whitespace characters left on the same line after `self`.
147148
///

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[toolchain]
22
# begin autogenerated nightly
3-
channel = "nightly-2025-04-22"
3+
channel = "nightly-2025-05-01"
44
# end autogenerated nightly
55
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
66
profile = "minimal"

tests/ui/blocks_in_conditions.fixed

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
//@aux-build:proc_macro_attr.rs
22

33
#![warn(clippy::blocks_in_conditions)]
4-
#![allow(unused, clippy::needless_if, clippy::missing_transmute_annotations)]
4+
#![allow(
5+
unused,
6+
unnecessary_transmutes,
7+
clippy::needless_if,
8+
clippy::missing_transmute_annotations
9+
)]
510
#![warn(clippy::nonminimal_bool)]
611

712
macro_rules! blocky {

tests/ui/blocks_in_conditions.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
//@aux-build:proc_macro_attr.rs
22

33
#![warn(clippy::blocks_in_conditions)]
4-
#![allow(unused, clippy::needless_if, clippy::missing_transmute_annotations)]
4+
#![allow(
5+
unused,
6+
unnecessary_transmutes,
7+
clippy::needless_if,
8+
clippy::missing_transmute_annotations
9+
)]
510
#![warn(clippy::nonminimal_bool)]
611

712
macro_rules! blocky {

tests/ui/blocks_in_conditions.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
2-
--> tests/ui/blocks_in_conditions.rs:25:5
2+
--> tests/ui/blocks_in_conditions.rs:30:5
33
|
44
LL | / if {
55
LL | |
@@ -20,13 +20,13 @@ LL ~ }; if res {
2020
|
2121

2222
error: omit braces around single expression condition
23-
--> tests/ui/blocks_in_conditions.rs:37:8
23+
--> tests/ui/blocks_in_conditions.rs:42:8
2424
|
2525
LL | if { true } { 6 } else { 10 }
2626
| ^^^^^^^^ help: try: `true`
2727

2828
error: this boolean expression can be simplified
29-
--> tests/ui/blocks_in_conditions.rs:43:8
29+
--> tests/ui/blocks_in_conditions.rs:48:8
3030
|
3131
LL | if true && x == 3 { 6 } else { 10 }
3232
| ^^^^^^^^^^^^^^ help: try: `x == 3`

tests/ui/checked_unwrap/simple_conditionals.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ LL | if result.is_ok() {
236236
LL | result.as_mut().unwrap();
237237
| ^^^^^^^^^^^^^^^^^^^^^^^^
238238

239-
error: creating a shared reference to mutable static is discouraged
239+
error: creating a shared reference to mutable static
240240
--> tests/ui/checked_unwrap/simple_conditionals.rs:183:12
241241
|
242242
LL | if X.is_some() {

tests/ui/crashes/ice-1782.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ check-pass
22

3-
#![allow(dead_code, unused_variables, invalid_null_arguments)]
3+
#![allow(dead_code, unused_variables, invalid_null_arguments, unnecessary_transmutes)]
44
#![allow(clippy::unnecessary_cast, clippy::missing_transmute_annotations)]
55

66
/// Should not trigger an ICE in `SpanlessEq` / `consts::constant`

tests/ui/needless_if.fixed

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ fn main() {
4646
if let true = true
4747
&& true
4848
{}
49-
if true
50-
&& let true = true
51-
{}
49+
if true && let true = true {}
5250
// Can lint nested `if let`s
5351
({
5452
//~^ needless_if

tests/ui/needless_if.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ fn main() {
4646
if let true = true
4747
&& true
4848
{}
49-
if true
50-
&& let true = true
51-
{}
49+
if true && let true = true {}
5250
// Can lint nested `if let`s
5351
if {
5452
//~^ needless_if

tests/ui/needless_if.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL + });
3131
|
3232

3333
error: this `if` branch is empty
34-
--> tests/ui/needless_if.rs:53:5
34+
--> tests/ui/needless_if.rs:51:5
3535
|
3636
LL | / if {
3737
LL | |
@@ -57,19 +57,19 @@ LL + } && true);
5757
|
5858

5959
error: this `if` branch is empty
60-
--> tests/ui/needless_if.rs:98:5
60+
--> tests/ui/needless_if.rs:96:5
6161
|
6262
LL | if { maybe_side_effect() } {}
6363
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() });`
6464

6565
error: this `if` branch is empty
66-
--> tests/ui/needless_if.rs:101:5
66+
--> tests/ui/needless_if.rs:99:5
6767
|
6868
LL | if { maybe_side_effect() } && true {}
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can remove it: `({ maybe_side_effect() } && true);`
7070

7171
error: this `if` branch is empty
72-
--> tests/ui/needless_if.rs:106:5
72+
--> tests/ui/needless_if.rs:104:5
7373
|
7474
LL | if true {}
7575
| ^^^^^^^^^^ help: you can remove it: `true;`

tests/ui/needless_late_init.fixed

+1-3
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ fn does_not_lint() {
246246
}
247247

248248
let x;
249-
if true
250-
&& let Some(n) = Some("let chains too")
251-
{
249+
if true && let Some(n) = Some("let chains too") {
252250
x = 1;
253251
} else {
254252
x = 2;

tests/ui/needless_late_init.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ fn does_not_lint() {
246246
}
247247

248248
let x;
249-
if true
250-
&& let Some(n) = Some("let chains too")
251-
{
249+
if true && let Some(n) = Some("let chains too") {
252250
x = 1;
253251
} else {
254252
x = 2;

tests/ui/needless_late_init.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ LL ~ };
276276
|
277277

278278
error: unneeded late initialization
279-
--> tests/ui/needless_late_init.rs:302:5
279+
--> tests/ui/needless_late_init.rs:300:5
280280
|
281281
LL | let r;
282282
| ^^^^^^ created here

tests/ui/ptr_eq.fixed

+4
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@ fn main() {
6060
// Do not peel the content of macros
6161
let _ = std::ptr::eq(mac!(cast a), mac!(cast b));
6262
//~^ ptr_eq
63+
64+
// Do not peel the content of macros
65+
let _ = std::ptr::eq(mac!(cast a), mac!(cast b));
66+
//~^ ptr_eq
6367
}

tests/ui/ptr_eq.rs

+4
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@ fn main() {
6060
// Do not peel the content of macros
6161
let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
6262
//~^ ptr_eq
63+
64+
// Do not peel the content of macros
65+
let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
66+
//~^ ptr_eq
6367
}

tests/ui/ptr_eq.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,11 @@ error: use `std::ptr::eq` when comparing raw pointers
3131
LL | let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`
3333

34-
error: aborting due to 5 previous errors
34+
error: use `std::ptr::eq` when comparing raw pointers
35+
--> tests/ui/ptr_eq.rs:65:13
36+
|
37+
LL | let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
38+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`
39+
40+
error: aborting due to 6 previous errors
3541

tests/ui/transmute.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![allow(
44
dead_code,
55
clippy::borrow_as_ptr,
6+
unnecessary_transmutes,
67
clippy::needless_lifetimes,
78
clippy::missing_transmute_annotations
89
)]

0 commit comments

Comments
 (0)