mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 12:36:47 +00:00
fix(needles_return): correct span selection for text replacement
This commit is contained in:
parent
b499b7dc73
commit
9cf57d0a8f
@ -286,7 +286,7 @@ fn check_final_expr<'tcx>(
|
||||
ExprKind::Match(_, arms, MatchSource::Normal) => {
|
||||
let match_ty = cx.typeck_results().expr_ty(peeled_drop_expr);
|
||||
for arm in arms.iter() {
|
||||
check_final_expr(cx, arm.body, semi_spans.clone(), RetReplacement::Empty, Some(match_ty));
|
||||
check_final_expr(cx, arm.body, semi_spans.clone(), RetReplacement::Unit, Some(match_ty));
|
||||
}
|
||||
},
|
||||
// if it's a whole block, check it
|
||||
|
@ -81,7 +81,7 @@ fn test_void_if_fun(b: bool) {
|
||||
fn test_void_match(x: u32) {
|
||||
match x {
|
||||
0 => (),
|
||||
_ =>(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ fn test_nested_match(x: u32) {
|
||||
1 => {
|
||||
let _ = 42;
|
||||
},
|
||||
_ =>(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ async fn async_test_void_if_fun(b: bool) {
|
||||
async fn async_test_void_match(x: u32) {
|
||||
match x {
|
||||
0 => (),
|
||||
_ =>(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,10 +118,10 @@ LL | | return;
|
||||
= help: remove `return`
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> $DIR/needless_return.rs:87:13
|
||||
--> $DIR/needless_return.rs:87:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^^
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: replace `return` with a unit value
|
||||
|
||||
@ -136,10 +136,10 @@ LL | | return;
|
||||
= help: remove `return`
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> $DIR/needless_return.rs:98:13
|
||||
--> $DIR/needless_return.rs:98:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^^
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: replace `return` with a unit value
|
||||
|
||||
@ -296,10 +296,10 @@ LL | | return;
|
||||
= help: remove `return`
|
||||
|
||||
error: unneeded `return` statement
|
||||
--> $DIR/needless_return.rs:207:13
|
||||
--> $DIR/needless_return.rs:207:14
|
||||
|
|
||||
LL | _ => return,
|
||||
| ^^^^^^^
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: replace `return` with a unit value
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user