From e7f199a2a3ee9b318794862afd7673f2454ed2fd Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Mon, 4 May 2026 16:47:52 -0400 Subject: [PATCH] Move warning for missing Rust extension into function body --- serialx/serialx_rust.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/serialx/serialx_rust.py b/serialx/serialx_rust.py index 1b5ade0..a63c67e 100644 --- a/serialx/serialx_rust.py +++ b/serialx/serialx_rust.py @@ -15,11 +15,12 @@ try: from serialx._serialx_rust import list_serial_ports_impl except ImportError: - LOGGER.warning( - "serialx Rust extension failed to load; serial port enumeration will " - "not be available" - ) def list_serial_ports_impl() -> list[RustSerialPortInfo]: """Return an empty list when the Rust extension is unavailable.""" + LOGGER.warning( + "serialx Rust extension failed to load; serial port enumeration will " + "not be available" + ) + return []