Skip to content

Commit a95afe2

Browse files
committed
Auto merge of rust-lang#13347 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents c95c767 + 3d027d7 commit a95afe2

21 files changed

+61
-48
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/implied_bounds_in_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
246246
&& let [.., path] = poly_trait.trait_ref.path.segments
247247
&& poly_trait.bound_generic_params.is_empty()
248248
&& let Some(trait_def_id) = path.res.opt_def_id()
249-
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
249+
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).skip_binder()
250250
// If the trait has no supertrait, there is no need to collect anything from that bound
251251
&& !predicates.is_empty()
252252
{

clippy_lints/src/methods/type_id_on_box.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
2525
|| cx
2626
.tcx
2727
.explicit_super_predicates_of(tr.def_id)
28-
.predicates
29-
.iter()
28+
.iter_identity_copied()
3029
.any(|(clause, _)| {
3130
matches!(clause.kind().skip_binder(), ty::ClauseKind::Trait(super_tr)
3231
if cx.tcx.is_diagnostic_item(sym::Any, super_tr.def_id()))

clippy_lints/src/needless_maybe_sized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
9191
return true;
9292
}
9393

94-
for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
94+
for (predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() {
9595
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
9696
&& trait_predicate.polarity == PredicatePolarity::Positive
9797
&& !path.contains(&trait_predicate.def_id())

clippy_lints/src/unused_io_amount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
242242

243243
/// If `expr` is an (e).await, return the inner expression "e" that's being
244244
/// waited on. Otherwise return None.
245-
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &hir::Expr<'a> {
245+
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
246246
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
247247
if let ExprKind::Call(func, [ref arg_0, ..]) = expr.kind {
248248
if matches!(

clippy_utils/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_utils"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
edition = "2021"
55
publish = false
66

declare_clippy_lint/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "declare_clippy_lint"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
edition = "2021"
55
publish = false
66

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2024-08-23"
2+
channel = "nightly-2024-09-05"
33
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
44
profile = "minimal"

tests/ui/floating_point_abs.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal ops in constant context

tests/ui/floating_point_abs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal ops in constant context

tests/ui/floating_point_abs.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: manual implementation of `abs` method
2-
--> tests/ui/floating_point_abs.rs:15:5
2+
--> tests/ui/floating_point_abs.rs:14:5
33
|
44
LL | if num >= 0.0 { num } else { -num }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
@@ -8,43 +8,43 @@ LL | if num >= 0.0 { num } else { -num }
88
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
99

1010
error: manual implementation of `abs` method
11-
--> tests/ui/floating_point_abs.rs:19:5
11+
--> tests/ui/floating_point_abs.rs:18:5
1212
|
1313
LL | if 0.0 < num { num } else { -num }
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
1515

1616
error: manual implementation of `abs` method
17-
--> tests/ui/floating_point_abs.rs:23:5
17+
--> tests/ui/floating_point_abs.rs:22:5
1818
|
1919
LL | if a.a > 0.0 { a.a } else { -a.a }
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
2121

2222
error: manual implementation of `abs` method
23-
--> tests/ui/floating_point_abs.rs:27:5
23+
--> tests/ui/floating_point_abs.rs:26:5
2424
|
2525
LL | if 0.0 >= num { -num } else { num }
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
2727

2828
error: manual implementation of `abs` method
29-
--> tests/ui/floating_point_abs.rs:31:5
29+
--> tests/ui/floating_point_abs.rs:30:5
3030
|
3131
LL | if a.a < 0.0 { -a.a } else { a.a }
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
3333

3434
error: manual implementation of negation of `abs` method
35-
--> tests/ui/floating_point_abs.rs:35:5
35+
--> tests/ui/floating_point_abs.rs:34:5
3636
|
3737
LL | if num < 0.0 { num } else { -num }
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
3939

4040
error: manual implementation of negation of `abs` method
41-
--> tests/ui/floating_point_abs.rs:39:5
41+
--> tests/ui/floating_point_abs.rs:38:5
4242
|
4343
LL | if 0.0 >= num { num } else { -num }
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
4545

4646
error: manual implementation of negation of `abs` method
47-
--> tests/ui/floating_point_abs.rs:44:12
47+
--> tests/ui/floating_point_abs.rs:43:12
4848
|
4949
LL | a: if a.a >= 0.0 { -a.a } else { a.a },
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-a.a.abs()`

tests/ui/floating_point_mul_add.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal_ops in constant context

tests/ui/floating_point_mul_add.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal_ops in constant context

tests/ui/floating_point_mul_add.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: multiply and add expressions can be calculated more efficiently and accurately
2-
--> tests/ui/floating_point_mul_add.rs:20:13
2+
--> tests/ui/floating_point_mul_add.rs:19:13
33
|
44
LL | let _ = a * b + c;
55
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
@@ -8,73 +8,73 @@ LL | let _ = a * b + c;
88
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
99

1010
error: multiply and add expressions can be calculated more efficiently and accurately
11-
--> tests/ui/floating_point_mul_add.rs:21:13
11+
--> tests/ui/floating_point_mul_add.rs:20:13
1212
|
1313
LL | let _ = a * b - c;
1414
| ^^^^^^^^^ help: consider using: `a.mul_add(b, -c)`
1515

1616
error: multiply and add expressions can be calculated more efficiently and accurately
17-
--> tests/ui/floating_point_mul_add.rs:22:13
17+
--> tests/ui/floating_point_mul_add.rs:21:13
1818
|
1919
LL | let _ = c + a * b;
2020
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
2121

2222
error: multiply and add expressions can be calculated more efficiently and accurately
23-
--> tests/ui/floating_point_mul_add.rs:23:13
23+
--> tests/ui/floating_point_mul_add.rs:22:13
2424
|
2525
LL | let _ = c - a * b;
2626
| ^^^^^^^^^ help: consider using: `a.mul_add(-b, c)`
2727

2828
error: multiply and add expressions can be calculated more efficiently and accurately
29-
--> tests/ui/floating_point_mul_add.rs:24:13
29+
--> tests/ui/floating_point_mul_add.rs:23:13
3030
|
3131
LL | let _ = a + 2.0 * 4.0;
3232
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)`
3333

3434
error: multiply and add expressions can be calculated more efficiently and accurately
35-
--> tests/ui/floating_point_mul_add.rs:25:13
35+
--> tests/ui/floating_point_mul_add.rs:24:13
3636
|
3737
LL | let _ = a + 2. * 4.;
3838
| ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)`
3939

4040
error: multiply and add expressions can be calculated more efficiently and accurately
41-
--> tests/ui/floating_point_mul_add.rs:27:13
41+
--> tests/ui/floating_point_mul_add.rs:26:13
4242
|
4343
LL | let _ = (a * b) + c;
4444
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
4545

4646
error: multiply and add expressions can be calculated more efficiently and accurately
47-
--> tests/ui/floating_point_mul_add.rs:28:13
47+
--> tests/ui/floating_point_mul_add.rs:27:13
4848
|
4949
LL | let _ = c + (a * b);
5050
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
5151

5252
error: multiply and add expressions can be calculated more efficiently and accurately
53-
--> tests/ui/floating_point_mul_add.rs:29:13
53+
--> tests/ui/floating_point_mul_add.rs:28:13
5454
|
5555
LL | let _ = a * b * c + d;
5656
| ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)`
5757

5858
error: multiply and add expressions can be calculated more efficiently and accurately
59-
--> tests/ui/floating_point_mul_add.rs:31:13
59+
--> tests/ui/floating_point_mul_add.rs:30:13
6060
|
6161
LL | let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
6363

6464
error: multiply and add expressions can be calculated more efficiently and accurately
65-
--> tests/ui/floating_point_mul_add.rs:32:13
65+
--> tests/ui/floating_point_mul_add.rs:31:13
6666
|
6767
LL | let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
6868
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
6969

7070
error: multiply and add expressions can be calculated more efficiently and accurately
71-
--> tests/ui/floating_point_mul_add.rs:34:13
71+
--> tests/ui/floating_point_mul_add.rs:33:13
7272
|
7373
LL | let _ = (a * a + b).sqrt();
7474
| ^^^^^^^^^^^ help: consider using: `a.mul_add(a, b)`
7575

7676
error: multiply and add expressions can be calculated more efficiently and accurately
77-
--> tests/ui/floating_point_mul_add.rs:37:13
77+
--> tests/ui/floating_point_mul_add.rs:36:13
7878
|
7979
LL | let _ = a - (b * u as f64);
8080
| ^^^^^^^^^^^^^^^^^^ help: consider using: `b.mul_add(-(u as f64), a)`

tests/ui/floating_point_rad.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal_flops in constant context

tests/ui/floating_point_rad.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_floating_point_arithmetic)]
21
#![warn(clippy::suboptimal_flops)]
32

43
/// Allow suboptimal_flops in constant context

tests/ui/floating_point_rad.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: conversion to radians can be done more accurately
2-
--> tests/ui/floating_point_rad.rs:11:13
2+
--> tests/ui/floating_point_rad.rs:10:13
33
|
44
LL | let _ = degrees as f64 * std::f64::consts::PI / 180.0;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_radians()`
@@ -8,43 +8,43 @@ LL | let _ = degrees as f64 * std::f64::consts::PI / 180.0;
88
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
99

1010
error: conversion to degrees can be done more accurately
11-
--> tests/ui/floating_point_rad.rs:12:13
11+
--> tests/ui/floating_point_rad.rs:11:13
1212
|
1313
LL | let _ = degrees as f64 * 180.0 / std::f64::consts::PI;
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_degrees()`
1515

1616
error: conversion to degrees can be done more accurately
17-
--> tests/ui/floating_point_rad.rs:17:13
17+
--> tests/ui/floating_point_rad.rs:16:13
1818
|
1919
LL | let _ = x * 180f32 / std::f32::consts::PI;
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_degrees()`
2121

2222
error: conversion to degrees can be done more accurately
23-
--> tests/ui/floating_point_rad.rs:18:13
23+
--> tests/ui/floating_point_rad.rs:17:13
2424
|
2525
LL | let _ = 90. * 180f64 / std::f64::consts::PI;
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_degrees()`
2727

2828
error: conversion to degrees can be done more accurately
29-
--> tests/ui/floating_point_rad.rs:19:13
29+
--> tests/ui/floating_point_rad.rs:18:13
3030
|
3131
LL | let _ = 90.5 * 180f64 / std::f64::consts::PI;
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_degrees()`
3333

3434
error: conversion to radians can be done more accurately
35-
--> tests/ui/floating_point_rad.rs:20:13
35+
--> tests/ui/floating_point_rad.rs:19:13
3636
|
3737
LL | let _ = x * std::f32::consts::PI / 180f32;
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_radians()`
3939

4040
error: conversion to radians can be done more accurately
41-
--> tests/ui/floating_point_rad.rs:21:13
41+
--> tests/ui/floating_point_rad.rs:20:13
4242
|
4343
LL | let _ = 90. * std::f32::consts::PI / 180f32;
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_radians()`
4545

4646
error: conversion to radians can be done more accurately
47-
--> tests/ui/floating_point_rad.rs:22:13
47+
--> tests/ui/floating_point_rad.rs:21:13
4848
|
4949
LL | let _ = 90.5 * std::f32::consts::PI / 180f32;
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_radians()`

tests/ui/needless_lifetimes.stderr

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
error: elided lifetime has a name
2+
--> tests/ui/needless_lifetimes.rs:266:52
3+
|
4+
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
5+
| -- ^ this elided lifetime gets resolved as `'a`
6+
| |
7+
| lifetime `'a` declared here
8+
|
9+
= note: `-D elided-named-lifetimes` implied by `-D warnings`
10+
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
11+
112
error: the following explicit lifetimes could be elided: 'a, 'b
213
--> tests/ui/needless_lifetimes.rs:17:23
314
|
@@ -553,5 +564,5 @@ LL - fn one_input<'a>(x: &'a u8) -> &'a u8 {
553564
LL + fn one_input(x: &u8) -> &u8 {
554565
|
555566

556-
error: aborting due to 46 previous errors
567+
error: aborting due to 47 previous errors
557568

tests/ui/ptr_arg.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
error: elided lifetime has a name
2+
--> tests/ui/ptr_arg.rs:295:56
3+
|
4+
LL | fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &str {
5+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
6+
|
7+
= note: `-D elided-named-lifetimes` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
9+
110
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
211
--> tests/ui/ptr_arg.rs:13:14
312
|
@@ -212,5 +221,5 @@ error: using a reference to `Cow` is not recommended
212221
LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
213222
| ^^^^^^^^^^^^^^^^ help: change this to: `&str`
214223

215-
error: aborting due to 24 previous errors
224+
error: aborting due to 25 previous errors
216225

0 commit comments

Comments
 (0)