Skip to content

Commit e8c381d

Browse files
committed
Fix clippy::blocks_in_conditions
1 parent 87d3d22 commit e8c381d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

rayon-core/src/scope/test.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,13 @@ fn panic_propagate_nested_scope_spawn() {
216216
#[cfg_attr(not(panic = "unwind"), ignore)]
217217
fn panic_propagate_still_execute_1() {
218218
let mut x = false;
219-
match unwind::halt_unwinding(|| {
219+
let result = unwind::halt_unwinding(|| {
220220
scope(|s| {
221221
s.spawn(|_| panic!("Hello, world!")); // job A
222222
s.spawn(|_| x = true); // job B, should still execute even though A panics
223223
});
224-
}) {
224+
});
225+
match result {
225226
Ok(_) => panic!("failed to propagate panic"),
226227
Err(_) => assert!(x, "job b failed to execute"),
227228
}
@@ -231,12 +232,13 @@ fn panic_propagate_still_execute_1() {
231232
#[cfg_attr(not(panic = "unwind"), ignore)]
232233
fn panic_propagate_still_execute_2() {
233234
let mut x = false;
234-
match unwind::halt_unwinding(|| {
235+
let result = unwind::halt_unwinding(|| {
235236
scope(|s| {
236237
s.spawn(|_| x = true); // job B, should still execute even though A panics
237238
s.spawn(|_| panic!("Hello, world!")); // job A
238239
});
239-
}) {
240+
});
241+
match result {
240242
Ok(_) => panic!("failed to propagate panic"),
241243
Err(_) => assert!(x, "job b failed to execute"),
242244
}
@@ -246,12 +248,13 @@ fn panic_propagate_still_execute_2() {
246248
#[cfg_attr(not(panic = "unwind"), ignore)]
247249
fn panic_propagate_still_execute_3() {
248250
let mut x = false;
249-
match unwind::halt_unwinding(|| {
251+
let result = unwind::halt_unwinding(|| {
250252
scope(|s| {
251253
s.spawn(|_| x = true); // spawned job should still execute despite later panic
252254
panic!("Hello, world!");
253255
});
254-
}) {
256+
});
257+
match result {
255258
Ok(_) => panic!("failed to propagate panic"),
256259
Err(_) => assert!(x, "panic after spawn, spawn failed to execute"),
257260
}
@@ -261,12 +264,13 @@ fn panic_propagate_still_execute_3() {
261264
#[cfg_attr(not(panic = "unwind"), ignore)]
262265
fn panic_propagate_still_execute_4() {
263266
let mut x = false;
264-
match unwind::halt_unwinding(|| {
267+
let result = unwind::halt_unwinding(|| {
265268
scope(|s| {
266269
s.spawn(|_| panic!("Hello, world!"));
267270
x = true;
268271
});
269-
}) {
272+
});
273+
match result {
270274
Ok(_) => panic!("failed to propagate panic"),
271275
Err(_) => assert!(x, "panic in spawn tainted scope"),
272276
}

0 commit comments

Comments
 (0)