Auto merge of #13347 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
a95afe2d0a
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.1.82"
|
||||
version = "0.1.83"
|
||||
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
||||
repository = "https://github.com/rust-lang/rust-clippy"
|
||||
readme = "README.md"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy_config"
|
||||
version = "0.1.82"
|
||||
version = "0.1.83"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy_lints"
|
||||
version = "0.1.82"
|
||||
version = "0.1.83"
|
||||
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
||||
repository = "https://github.com/rust-lang/rust-clippy"
|
||||
readme = "README.md"
|
||||
|
@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
|
||||
&& let [.., path] = poly_trait.trait_ref.path.segments
|
||||
&& poly_trait.bound_generic_params.is_empty()
|
||||
&& let Some(trait_def_id) = path.res.opt_def_id()
|
||||
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
|
||||
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).skip_binder()
|
||||
// If the trait has no supertrait, there is no need to collect anything from that bound
|
||||
&& !predicates.is_empty()
|
||||
{
|
||||
|
@ -25,8 +25,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
|
||||
|| cx
|
||||
.tcx
|
||||
.explicit_super_predicates_of(tr.def_id)
|
||||
.predicates
|
||||
.iter()
|
||||
.iter_identity_copied()
|
||||
.any(|(clause, _)| {
|
||||
matches!(clause.kind().skip_binder(), ty::ClauseKind::Trait(super_tr)
|
||||
if cx.tcx.is_diagnostic_item(sym::Any, super_tr.def_id()))
|
||||
|
@ -91,7 +91,7 @@ fn search(cx: &LateContext<'_>, path: &mut Vec<DefId>) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
|
||||
for (predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).iter_identity_copied() {
|
||||
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
|
||||
&& trait_predicate.polarity == PredicatePolarity::Positive
|
||||
&& !path.contains(&trait_predicate.def_id())
|
||||
|
@ -242,7 +242,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
|
||||
|
||||
/// If `expr` is an (e).await, return the inner expression "e" that's being
|
||||
/// waited on. Otherwise return None.
|
||||
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &hir::Expr<'a> {
|
||||
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
|
||||
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
|
||||
if let ExprKind::Call(func, [ref arg_0, ..]) = expr.kind {
|
||||
if matches!(
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "clippy_utils"
|
||||
version = "0.1.82"
|
||||
version = "0.1.83"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "declare_clippy_lint"
|
||||
version = "0.1.82"
|
||||
version = "0.1.83"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2024-08-23"
|
||||
channel = "nightly-2024-09-05"
|
||||
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
profile = "minimal"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal ops in constant context
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal ops in constant context
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: manual implementation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:15:5
|
||||
--> tests/ui/floating_point_abs.rs:14:5
|
||||
|
|
||||
LL | if num >= 0.0 { num } else { -num }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
||||
@ -8,43 +8,43 @@ LL | if num >= 0.0 { num } else { -num }
|
||||
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
||||
|
||||
error: manual implementation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:19:5
|
||||
--> tests/ui/floating_point_abs.rs:18:5
|
||||
|
|
||||
LL | if 0.0 < num { num } else { -num }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
||||
|
||||
error: manual implementation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:23:5
|
||||
--> tests/ui/floating_point_abs.rs:22:5
|
||||
|
|
||||
LL | if a.a > 0.0 { a.a } else { -a.a }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
|
||||
|
||||
error: manual implementation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:27:5
|
||||
--> tests/ui/floating_point_abs.rs:26:5
|
||||
|
|
||||
LL | if 0.0 >= num { -num } else { num }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.abs()`
|
||||
|
||||
error: manual implementation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:31:5
|
||||
--> tests/ui/floating_point_abs.rs:30:5
|
||||
|
|
||||
LL | if a.a < 0.0 { -a.a } else { a.a }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.a.abs()`
|
||||
|
||||
error: manual implementation of negation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:35:5
|
||||
--> tests/ui/floating_point_abs.rs:34:5
|
||||
|
|
||||
LL | if num < 0.0 { num } else { -num }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
||||
|
||||
error: manual implementation of negation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:39:5
|
||||
--> tests/ui/floating_point_abs.rs:38:5
|
||||
|
|
||||
LL | if 0.0 >= num { num } else { -num }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-num.abs()`
|
||||
|
||||
error: manual implementation of negation of `abs` method
|
||||
--> tests/ui/floating_point_abs.rs:44:12
|
||||
--> tests/ui/floating_point_abs.rs:43:12
|
||||
|
|
||||
LL | a: if a.a >= 0.0 { -a.a } else { a.a },
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-a.a.abs()`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal_ops in constant context
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal_ops in constant context
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:20:13
|
||||
--> tests/ui/floating_point_mul_add.rs:19:13
|
||||
|
|
||||
LL | let _ = a * b + c;
|
||||
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
||||
@ -8,73 +8,73 @@ LL | let _ = a * b + c;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:21:13
|
||||
--> tests/ui/floating_point_mul_add.rs:20:13
|
||||
|
|
||||
LL | let _ = a * b - c;
|
||||
| ^^^^^^^^^ help: consider using: `a.mul_add(b, -c)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:22:13
|
||||
--> tests/ui/floating_point_mul_add.rs:21:13
|
||||
|
|
||||
LL | let _ = c + a * b;
|
||||
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:23:13
|
||||
--> tests/ui/floating_point_mul_add.rs:22:13
|
||||
|
|
||||
LL | let _ = c - a * b;
|
||||
| ^^^^^^^^^ help: consider using: `a.mul_add(-b, c)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:24:13
|
||||
--> tests/ui/floating_point_mul_add.rs:23:13
|
||||
|
|
||||
LL | let _ = a + 2.0 * 4.0;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:25:13
|
||||
--> tests/ui/floating_point_mul_add.rs:24:13
|
||||
|
|
||||
LL | let _ = a + 2. * 4.;
|
||||
| ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:27:13
|
||||
--> tests/ui/floating_point_mul_add.rs:26:13
|
||||
|
|
||||
LL | let _ = (a * b) + c;
|
||||
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:28:13
|
||||
--> tests/ui/floating_point_mul_add.rs:27:13
|
||||
|
|
||||
LL | let _ = c + (a * b);
|
||||
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:29:13
|
||||
--> tests/ui/floating_point_mul_add.rs:28:13
|
||||
|
|
||||
LL | let _ = a * b * c + d;
|
||||
| ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:31:13
|
||||
--> tests/ui/floating_point_mul_add.rs:30:13
|
||||
|
|
||||
LL | let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:32:13
|
||||
--> tests/ui/floating_point_mul_add.rs:31:13
|
||||
|
|
||||
LL | let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:34:13
|
||||
--> tests/ui/floating_point_mul_add.rs:33:13
|
||||
|
|
||||
LL | let _ = (a * a + b).sqrt();
|
||||
| ^^^^^^^^^^^ help: consider using: `a.mul_add(a, b)`
|
||||
|
||||
error: multiply and add expressions can be calculated more efficiently and accurately
|
||||
--> tests/ui/floating_point_mul_add.rs:37:13
|
||||
--> tests/ui/floating_point_mul_add.rs:36:13
|
||||
|
|
||||
LL | let _ = a - (b * u as f64);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using: `b.mul_add(-(u as f64), a)`
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal_flops in constant context
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![warn(clippy::suboptimal_flops)]
|
||||
|
||||
/// Allow suboptimal_flops in constant context
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: conversion to radians can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:11:13
|
||||
--> tests/ui/floating_point_rad.rs:10:13
|
||||
|
|
||||
LL | let _ = degrees as f64 * std::f64::consts::PI / 180.0;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_radians()`
|
||||
@ -8,43 +8,43 @@ LL | let _ = degrees as f64 * std::f64::consts::PI / 180.0;
|
||||
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
|
||||
|
||||
error: conversion to degrees can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:12:13
|
||||
--> tests/ui/floating_point_rad.rs:11:13
|
||||
|
|
||||
LL | let _ = degrees as f64 * 180.0 / std::f64::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(degrees as f64).to_degrees()`
|
||||
|
||||
error: conversion to degrees can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:17:13
|
||||
--> tests/ui/floating_point_rad.rs:16:13
|
||||
|
|
||||
LL | let _ = x * 180f32 / std::f32::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_degrees()`
|
||||
|
||||
error: conversion to degrees can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:18:13
|
||||
--> tests/ui/floating_point_rad.rs:17:13
|
||||
|
|
||||
LL | let _ = 90. * 180f64 / std::f64::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_degrees()`
|
||||
|
||||
error: conversion to degrees can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:19:13
|
||||
--> tests/ui/floating_point_rad.rs:18:13
|
||||
|
|
||||
LL | let _ = 90.5 * 180f64 / std::f64::consts::PI;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_degrees()`
|
||||
|
||||
error: conversion to radians can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:20:13
|
||||
--> tests/ui/floating_point_rad.rs:19:13
|
||||
|
|
||||
LL | let _ = x * std::f32::consts::PI / 180f32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.to_radians()`
|
||||
|
||||
error: conversion to radians can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:21:13
|
||||
--> tests/ui/floating_point_rad.rs:20:13
|
||||
|
|
||||
LL | let _ = 90. * std::f32::consts::PI / 180f32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.0_f64.to_radians()`
|
||||
|
||||
error: conversion to radians can be done more accurately
|
||||
--> tests/ui/floating_point_rad.rs:22:13
|
||||
--> tests/ui/floating_point_rad.rs:21:13
|
||||
|
|
||||
LL | let _ = 90.5 * std::f32::consts::PI / 180f32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `90.5_f64.to_radians()`
|
||||
|
@ -1,3 +1,14 @@
|
||||
error: elided lifetime has a name
|
||||
--> tests/ui/needless_lifetimes.rs:266:52
|
||||
|
|
||||
LL | fn named_input_elided_output<'a>(_arg: &'a str) -> &str {
|
||||
| -- ^ this elided lifetime gets resolved as `'a`
|
||||
| |
|
||||
| lifetime `'a` declared here
|
||||
|
|
||||
= note: `-D elided-named-lifetimes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
|
||||
|
||||
error: the following explicit lifetimes could be elided: 'a, 'b
|
||||
--> tests/ui/needless_lifetimes.rs:17:23
|
||||
|
|
||||
@ -553,5 +564,5 @@ LL - fn one_input<'a>(x: &'a u8) -> &'a u8 {
|
||||
LL + fn one_input(x: &u8) -> &u8 {
|
||||
|
|
||||
|
||||
error: aborting due to 46 previous errors
|
||||
error: aborting due to 47 previous errors
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
error: elided lifetime has a name
|
||||
--> tests/ui/ptr_arg.rs:295:56
|
||||
|
|
||||
LL | fn cow_good_ret_ty<'a>(input: &'a Cow<'a, str>) -> &str {
|
||||
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
|
||||
|
|
||||
= note: `-D elided-named-lifetimes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
|
||||
|
||||
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
|
||||
--> tests/ui/ptr_arg.rs:13:14
|
||||
|
|
||||
@ -212,5 +221,5 @@ error: using a reference to `Cow` is not recommended
|
||||
LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `&str`
|
||||
|
||||
error: aborting due to 24 previous errors
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user