Skip to content

Commit a089c00

Browse files
committed
add return statement test
1 parent 1d69eeb commit a089c00

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

clippy_lints/src/zombie_processes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fn check<'tcx>(cx: &LateContext<'tcx>, spawn_expr: &'tcx Expr<'tcx>, node_id: Hi
263263
fn is_last_node_in_main(cx: &LateContext<'_>, id: HirId) -> bool {
264264
let hir = cx.tcx.hir();
265265
let body_owner = hir.enclosing_body_owner(id);
266-
let enclosing_body = hir.body(hir.body_owned_by(body_owner));
266+
let enclosing_body = hir.body_owned_by(body_owner);
267267

268268
if let Some((main_def_id, _)) = cx.tcx.entry_fn(())
269269
&& main_def_id == body_owner.to_def_id()

tests/ui/zombie_processes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![warn(clippy::zombie_processes)]
2-
#![feature(lint_reasons)]
32
#![allow(clippy::if_same_then_else, clippy::ifs_same_cond)]
43

54
use std::process::{Child, Command};

tests/ui/zombie_processes.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: spawned process is never `wait()`ed on
2-
--> tests/ui/zombie_processes.rs:15:21
2+
--> tests/ui/zombie_processes.rs:14:21
33
|
44
LL | let mut x = Command::new("").spawn().unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -11,7 +11,7 @@ LL | let mut x = Command::new("").spawn().unwrap();
1111
= help: to override `-D warnings` add `#[allow(clippy::zombie_processes)]`
1212

1313
error: spawned process is never `wait()`ed on
14-
--> tests/ui/zombie_processes.rs:42:21
14+
--> tests/ui/zombie_processes.rs:41:21
1515
|
1616
LL | let mut x = Command::new("").spawn().unwrap();
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -21,7 +21,7 @@ LL | let mut x = Command::new("").spawn().unwrap();
2121
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
2222

2323
error: spawned process is never `wait()`ed on
24-
--> tests/ui/zombie_processes.rs:67:21
24+
--> tests/ui/zombie_processes.rs:66:21
2525
|
2626
LL | let mut x = Command::new("").spawn().unwrap();
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL | let mut x = Command::new("").spawn().unwrap();
3131
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
3232

3333
error: spawned process is never `wait()`ed on
34-
--> tests/ui/zombie_processes.rs:74:21
34+
--> tests/ui/zombie_processes.rs:73:21
3535
|
3636
LL | let mut x = Command::new("").spawn().unwrap();
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ LL | let mut x = Command::new("").spawn().unwrap();
4141
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
4242

4343
error: spawned process is never `wait()`ed on
44-
--> tests/ui/zombie_processes.rs:100:21
44+
--> tests/ui/zombie_processes.rs:99:21
4545
|
4646
LL | let mut x = Command::new("").spawn().unwrap();
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ LL | let mut x = Command::new("").spawn().unwrap();
5151
= note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning
5252

5353
error: spawned process is never `wait()`ed on
54-
--> tests/ui/zombie_processes.rs:109:21
54+
--> tests/ui/zombie_processes.rs:108:21
5555
|
5656
LL | let mut x = Command::new("").spawn().unwrap();
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/zombie_processes_fixable.rs

+4
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ fn not_main() {
1919
fn spawn_proc() -> Child {
2020
Command::new("").spawn().unwrap()
2121
}
22+
23+
fn spawn_proc_2() -> Child {
24+
return Command::new("").spawn().unwrap();
25+
}

0 commit comments

Comments
 (0)