Skip to content

Commit 3132da3

Browse files
committed
test(hiroz-tests): collapse nested if in ProducerGuard drop
1 parent 1abbb5d commit 3132da3

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

  • crates/hiroz-tests/tests/common

crates/hiroz-tests/tests/common/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -461,19 +461,19 @@ impl Drop for ProducerGuard {
461461
// make a later "entity never appeared" failure baffling. Since the
462462
// thread is finished, `join()` returns immediately (still
463463
// non-blocking), so we can observe and surface the panic.
464-
if handle.is_finished() {
465-
if let Err(panic) = handle.join() {
466-
let msg = panic
467-
.downcast_ref::<&str>()
468-
.map(|s| s.to_string())
469-
.or_else(|| panic.downcast_ref::<String>().cloned())
470-
.unwrap_or_else(|| "<non-string panic payload>".to_string());
471-
eprintln!(
472-
"WARNING: test producer thread exited early (before teardown) \
473-
with a panic: {msg}. Downstream 'entity not discovered' \
474-
failures in this test are likely caused by this."
475-
);
476-
}
464+
if handle.is_finished()
465+
&& let Err(panic) = handle.join()
466+
{
467+
let msg = panic
468+
.downcast_ref::<&str>()
469+
.map(|s| s.to_string())
470+
.or_else(|| panic.downcast_ref::<String>().cloned())
471+
.unwrap_or_else(|| "<non-string panic payload>".to_string());
472+
eprintln!(
473+
"WARNING: test producer thread exited early (before teardown) \
474+
with a panic: {msg}. Downstream 'entity not discovered' \
475+
failures in this test are likely caused by this."
476+
);
477477
}
478478
// Otherwise: drop the JoinHandle without joining, detaching the
479479
// still-running thread (its Zenoh-session teardown can block, and we

0 commit comments

Comments
 (0)