From 612b6768c0b0099d8b1bbd4f51014bc0cacba0b6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 11 Nov 2021 16:35:40 +0800 Subject: [PATCH] nac3artiq: bail early on non-NAC3 classes --- nac3artiq/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nac3artiq/src/lib.rs b/nac3artiq/src/lib.rs index ee67cb83..d417306c 100644 --- a/nac3artiq/src/lib.rs +++ b/nac3artiq/src/lib.rs @@ -120,13 +120,16 @@ impl Nac3 { ref mut bases, .. } => { - let kernels = decorator_list.iter().any(|decorator| { + let nac3_class = decorator_list.iter().any(|decorator| { if let ast::ExprKind::Name { id, .. } = decorator.node { id.to_string() == "nac3" } else { false } }); + if !nac3_class { + continue; + } // Drop unregistered (i.e. host-only) base classes. bases.retain(|base| { Python::with_gil(|py| -> PyResult { @@ -157,7 +160,7 @@ impl Nac3 { true } }); - kernels + true } ast::StmtKind::FunctionDef { ref decorator_list, ..