Fix clippy

This commit is contained in:
Michael Goulet 2023-10-02 21:24:23 +00:00
parent 137b6d0b01
commit 89b14ae212
7 changed files with 14 additions and 18 deletions

View File

@ -102,14 +102,10 @@ pub(super) fn check(
]), ]),
("None", "unwrap_or_else", _) => match args[0].kind { ("None", "unwrap_or_else", _) => match args[0].kind {
hir::ExprKind::Closure(hir::Closure { hir::ExprKind::Closure(hir::Closure {
fn_decl: body,
hir::FnDecl {
output: hir::FnRetTy::DefaultReturn(span) | hir::FnRetTy::Return(hir::Ty { span, .. }),
..
},
.. ..
}) => Some(vec![ }) => Some(vec![
(expr.span.with_hi(span.hi()), String::new()), (expr.span.with_hi(cx.tcx.hir().body(*body).value.span.lo()), String::new()),
(expr.span.with_lo(args[0].span.hi()), String::new()), (expr.span.with_lo(args[0].span.hi()), String::new()),
]), ]),
_ => None, _ => None,

View File

@ -2,7 +2,7 @@ error: this function has too many arguments (11/10)
--> $DIR/too_many_arguments.rs:4:1 --> $DIR/too_many_arguments.rs:4:1
| |
LL | fn too_many(p1: u8, p2: u8, p3: u8, p4: u8, p5: u8, p6: u8, p7: u8, p8: u8, p9: u8, p10: u8, p11: u8) {} LL | fn too_many(p1: u8, p2: u8, p3: u8, p4: u8, p5: u8, p6: u8, p7: u8, p8: u8, p9: u8, p10: u8, p11: u8) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::too-many-arguments` implied by `-D warnings` = note: `-D clippy::too-many-arguments` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]` = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`

View File

@ -12,7 +12,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: &[u8]| x }]> {
| + | +
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/ice-6251.rs:4:54 --> $DIR/ice-6251.rs:4:53
| |
LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> { LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
| ^ doesn't have a size known at compile-time | ^ doesn't have a size known at compile-time

View File

@ -2,7 +2,7 @@ error: this function has too many arguments (8/7)
--> $DIR/functions.rs:8:1 --> $DIR/functions.rs:8:1
| |
LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::too-many-arguments` implied by `-D warnings` = note: `-D clippy::too-many-arguments` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]` = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`
@ -17,7 +17,7 @@ LL | | two: u32,
... | ... |
LL | | eight: () LL | | eight: ()
LL | | ) { LL | | ) {
| |__^ | |_^
error: this function has too many arguments (8/7) error: this function has too many arguments (8/7)
--> $DIR/functions.rs:48:5 --> $DIR/functions.rs:48:5
@ -29,7 +29,7 @@ error: this function has too many arguments (8/7)
--> $DIR/functions.rs:58:5 --> $DIR/functions.rs:58:5
| |
LL | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} LL | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this public function might dereference a raw pointer but is not marked `unsafe` error: this public function might dereference a raw pointer but is not marked `unsafe`
--> $DIR/functions.rs:68:34 --> $DIR/functions.rs:68:34

View File

@ -4,7 +4,7 @@ error: this unit-returning function has a `#[must_use]` attribute
LL | #[must_use] LL | #[must_use]
| ----------- help: remove the attribute | ----------- help: remove the attribute
LL | pub fn must_use_default() {} LL | pub fn must_use_default() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::must-use-unit` implied by `-D warnings` = note: `-D clippy::must-use-unit` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]` = help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]`
@ -23,7 +23,7 @@ error: this unit-returning function has a `#[must_use]` attribute
LL | #[must_use = "With note"] LL | #[must_use = "With note"]
| ------------------------- help: remove the attribute | ------------------------- help: remove the attribute
LL | pub fn must_use_with_note() {} LL | pub fn must_use_with_note() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors