From 581e6a0c52cc7cb1e6fd5e0d65a83630a00f8551 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 29 Jun 2022 06:34:36 -0500 Subject: [refactor] drop-unit to use when-let --- wheelwork.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wheelwork.lisp') diff --git a/wheelwork.lisp b/wheelwork.lisp index 6dd8f64..9d7571d 100644 --- a/wheelwork.lisp +++ b/wheelwork.lisp @@ -63,9 +63,9 @@ (defmethod drop-unit ((unit unit)) "Removes a unit from its container. Returns T if the unit actually was removed." - (when (unit-container unit) + (when-let (container (unit-container unit)) (setf - (container-units (unit-container unit)) (delete unit (container-units (unit-container unit))) + (container-units container) (delete unit (container-units container)) (unit-container unit) nil) t)) -- cgit v1.2.3