From 14ee9b43fb077d73d332db2fdef705be1f687958 Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Mon, 9 Jan 2023 18:02:55 +0100 Subject: [PATCH] avm2: Replace ok_or by ok_or_else --- core/src/avm2/object/class_object.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/avm2/object/class_object.rs b/core/src/avm2/object/class_object.rs index ab66625ee64b..abe675e0ae52 100644 --- a/core/src/avm2/object/class_object.rs +++ b/core/src/avm2/object/class_object.rs @@ -868,10 +868,12 @@ impl<'gc> TObject<'gc> for ClassObject<'gc> { }; let object_param = match object_param { None => None, - Some(cls) => Some(cls.as_class_object().ok_or(format!( - "Cannot apply class {:?} with non-class parameter", - self_class.read().name() - ))?), + Some(cls) => Some(cls.as_class_object().ok_or_else(|| { + format!( + "Cannot apply class {:?} with non-class parameter", + self_class.read().name() + ) + })?), }; if let Some(application) = self.0.read().applications.get(&object_param) {