From patchwork Sun Sep 8 10:05:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7, of, 7] rust-cpython: leverage py_shared_iterator::from_inner() where appropriate From: Yuya Nishihara X-Patchwork-Id: 41577 Message-Id: <8174e0c96c14e5b5e230.1567937147@mimosa> To: mercurial-devel@mercurial-scm.org Date: Sun, 08 Sep 2019 19:05:47 +0900 # HG changeset patch # User Yuya Nishihara # Date 1567916635 -32400 # Sun Sep 08 13:23:55 2019 +0900 # Node ID 8174e0c96c14e5b5e2309a9de1a90b7c446b5aab # Parent 1fa833aa2e43f6b3055d618755f10daeefacb0ae rust-cpython: leverage py_shared_iterator::from_inner() where appropriate diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs b/rust/hg-cpython/src/dirstate/dirs_multiset.rs --- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs +++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs @@ -90,10 +90,10 @@ py_class!(pub class Dirs |py| { } def __iter__(&self) -> PyResult { let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? }; - DirsMultisetKeysIterator::create_instance( + DirsMultisetKeysIterator::from_inner( py, - RefCell::new(Some(leak_handle)), - RefCell::new(leaked_ref.iter()), + leak_handle, + leaked_ref.iter(), ) } diff --git a/rust/hg-cpython/src/ref_sharing.rs b/rust/hg-cpython/src/ref_sharing.rs --- a/rust/hg-cpython/src/ref_sharing.rs +++ b/rust/hg-cpython/src/ref_sharing.rs @@ -309,10 +309,10 @@ macro_rules! py_shared_ref { /// /// def __iter__(&self) -> PyResult { /// let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? }; -/// MyTypeItemsIterator::create_instance( +/// MyTypeItemsIterator::from_inner( /// py, -/// RefCell::new(Some(leak_handle)), -/// RefCell::new(leaked_ref.iter()), +/// leak_handle, +/// leaked_ref.iter(), /// ) /// } /// });