diff --git a/src/types/boxed.rs b/src/types/boxed.rs index 73c060ebc..3b9e6378a 100644 --- a/src/types/boxed.rs +++ b/src/types/boxed.rs @@ -370,7 +370,7 @@ impl Finalize for Vec { } } -// Smart Pointers +// Smart pointers and other wrappers impl Finalize for std::boxed::Box { fn finalize<'a, C: Context<'a>>(self, cx: &mut C) { @@ -378,6 +378,14 @@ impl Finalize for std::boxed::Box { } } +impl Finalize for Option { + fn finalize<'a, C: Context<'a>>(self, cx: &mut C) { + if let Some(v) = self { + v.finalize(cx); + } + } +} + impl Finalize for std::rc::Rc { fn finalize<'a, C: Context<'a>>(self, cx: &mut C) { if let Ok(v) = std::rc::Rc::try_unwrap(self) {