Skip to content

Commit

Permalink
avm2: Replace ok_or by ok_or_else
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian17 committed Jan 9, 2023
1 parent b07a01d commit 14ee9b4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/avm2/object/class_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 14ee9b4

Please sign in to comment.