diff rust/hg-cpython/src/ref_sharing.rs @ 42896:74d67c645278

rust-cpython: remove Option<_> from interface of py_shared_iterator It's the implementation detail of the py_shared_iterator that the leaked reference is kept in Option<_> so that it can be dropped early.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Sep 2019 13:08:59 +0900
parents ea91a126c803
children 5ccc08d02280
line wrap: on
line diff
--- a/rust/hg-cpython/src/ref_sharing.rs	Sun Sep 08 12:26:12 2019 +0900
+++ b/rust/hg-cpython/src/ref_sharing.rs	Sun Sep 08 13:08:59 2019 +0900
@@ -378,12 +378,12 @@
         impl $name {
             pub fn from_inner(
                 py: Python,
-                leaked: Option<$leaked>,
+                leaked: $leaked,
                 it: $iterator_type
             ) -> PyResult<Self> {
                 Self::create_instance(
                     py,
-                    RefCell::new(leaked),
+                    RefCell::new(Some(leaked)),
                     RefCell::new(it)
                 )
             }