Fix clippy · rust-lang/rust@89b14ae (original) (raw)
7 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -102,14 +102,10 @@ pub(super) fn check( | ||
102 | 102 | ]), |
103 | 103 | ("None", "unwrap_or_else", _) => match args[0].kind { |
104 | 104 | hir::ExprKind::Closure(hir::Closure { |
105 | -fn_decl: | |
106 | - hir::FnDecl { | |
107 | -output: hir::FnRetTy::DefaultReturn(span) | hir::FnRetTy::Return(hir::Ty { span, .. }), | |
108 | - .. | |
109 | -}, | |
105 | + body, | |
110 | 106 | .. |
111 | 107 | }) => Some(vec![ |
112 | -(expr.span.with_hi(span.hi()), String::new()), | |
108 | +(expr.span.with_hi(cx.tcx.hir().body(*body).value.span.lo()), String::new()), | |
113 | 109 | (expr.span.with_lo(args[0].span.hi()), String::new()), |
114 | 110 | ]), |
115 | 111 | _ => None, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,7 +2,7 @@ error: this function has too many arguments (11/10) | ||
2 | 2 | --> $DIR/too_many_arguments.rs:4:1 |
3 | 3 | | |
4 | 4 | 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) {} |
5 | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
6 | 6 | | |
7 | 7 | = note: `-D clippy::too-many-arguments` implied by `-D warnings` |
8 | 8 | = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]` |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
@@ -12,10 +12,10 @@ LL | fn bug() -> impl Iterator<Item = [(); { | x: &[u8] | x }]> { | |
12 | 12 | | + | |
13 | 13 | ||
14 | 14 | error[E0277]: the size for values of type `[u8]` cannot be known at compilation time | |
15 | - --> $DIR/ice-6251.rs:4:54 | ||
15 | + --> $DIR/ice-6251.rs:4:53 | ||
16 | 16 | | | |
17 | 17 | LL | fn bug() -> impl Iterator<Item = [(); { | x: [u8] |
18 | - | ^ doesn't have a size known at compile-time | ||
18 | + | ^ doesn't have a size known at compile-time | ||
19 | 19 | | | |
20 | 20 | = help: the trait `std:📑:Sized` is not implemented for `[u8]` | |
21 | 21 | = note: the return type of a function must have a statically known size |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
@@ -2,7 +2,7 @@ error: this function has too many arguments (8/7) | |||
2 | 2 | --> $DIR/functions.rs:8:1 | |
3 | 3 | | | |
4 | 4 | LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | |
5 | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
6 | 6 | | | |
7 | 7 | = note: `-D clippy::too-many-arguments` implied by `-D warnings` | |
8 | 8 | = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]` | |
@@ -17,7 +17,7 @@ LL | | two: u32, | ||
17 | 17 | ... | | |
18 | 18 | LL | | eight: () |
19 | 19 | LL | | ) { |
20 | - | | __^ | |
20 | + | | _^ | |
21 | 21 | ||
22 | 22 | error: this function has too many arguments (8/7) | |
23 | 23 | --> $DIR/functions.rs:48:5 | |
@@ -29,7 +29,7 @@ error: this function has too many arguments (8/7) | |||
29 | 29 | --> $DIR/functions.rs:58:5 | |
30 | 30 | | | |
31 | 31 | LL | fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {} | |
32 | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
32 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
33 | 33 | ||
34 | 34 | error: this public function might dereference a raw pointer but is not marked `unsafe` | |
35 | 35 | --> $DIR/functions.rs:68:34 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,7 +4,7 @@ error: this unit-returning function has a `#[must_use]` attribute | ||
4 | 4 | LL | #[must_use] |
5 | 5 | | ----------- help: remove the attribute |
6 | 6 | LL | pub fn must_use_default() {} |
7 | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
7 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
8 | 8 | | |
9 | 9 | = note: `-D clippy::must-use-unit` implied by `-D warnings` |
10 | 10 | = 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 | ||
23 | 23 | LL | #[must_use = "With note"] |
24 | 24 | | ------------------------- help: remove the attribute |
25 | 25 | LL | pub fn must_use_with_note() {} |
26 | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
26 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
27 | 27 | |
28 | 28 | error: aborting due to 3 previous errors |
29 | 29 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,15 +23,15 @@ fn unwrap_option_none() { | ||
23 | 23 | let _val: u16 = 234; |
24 | 24 | let _val: u16 = 234; |
25 | 25 | let _val: u16 = { 234 }; |
26 | - let _val: u16 = { 234 }; | |
26 | + let _val: u16 = { 234 }; | |
27 | 27 | |
28 | 28 | panic!(); |
29 | 29 | panic!("this always happens"); |
30 | 30 | String::default(); |
31 | 31 | 234; |
32 | 32 | 234; |
33 | 33 | { 234 }; |
34 | - { 234 }; | |
34 | + { 234 }; | |
35 | 35 | } |
36 | 36 | |
37 | 37 | fn unwrap_result_ok() { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -116,7 +116,7 @@ LL | let _val: u16 = None.unwrap_or_else( | -> u16 { 234 }); | |
116 | 116 | help: remove the `None` and `unwrap_or_else()` |
117 | 117 | | |
118 | 118 | LL - let _val: u16 = None.unwrap_or_else(| |
119 | -LL + let _val: u16 = { 234 }; | |
119 | +LL + let _val: u16 = { 234 }; | |
120 | 120 | | |
121 | 121 | |
122 | 122 | error: used `unwrap()` on `None` value |
@@ -187,7 +187,7 @@ LL | None::.unwrap_or_else( | -> u16 { 234 }); | |
187 | 187 | help: remove the `None` and `unwrap_or_else()` |
188 | 188 | | |
189 | 189 | LL - None::.unwrap_or_else(| |
190 | -LL + { 234 }; | |
190 | +LL + { 234 }; | |
191 | 191 | | |
192 | 192 | |
193 | 193 | error: used `unwrap()` on `Ok` value |