Patchwork D5548: rust-cpython: style consistency leftovers

login
register
mail settings
Submitter phabricator
Date Jan. 11, 2019, 2:16 p.m.
Message ID <d9589e9aa56746c41afcbd0de55a1854@localhost.localdomain>
Download mbox | patch
Permalink /patch/37670/
State Not Applicable
Headers show

Comments

phabricator - Jan. 11, 2019, 2:16 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1b4b94bac8a0: rust-cpython: style consistency leftovers (authored by gracinet, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5548?vs=13126&id=13172

REVISION DETAIL
  https://phab.mercurial-scm.org/D5548

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs

CHANGE DETAILS




To: gracinet, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel

Patch

diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -43,7 +43,6 @@ 
 }
 
 py_class!(pub class AncestorsIterator |py| {
-    // TODO RW lock ?
     data inner: RefCell<Box<CoreIterator<Index>>>;
 
     def __next__(&self) -> PyResult<Option<Revision>> {
@@ -55,7 +54,8 @@ 
     }
 
     def __contains__(&self, rev: Revision) -> PyResult<bool> {
-        self.inner(py).borrow_mut().contains(rev).map_err(|e| GraphError::pynew(py, e))
+        self.inner(py).borrow_mut().contains(rev)
+            .map_err(|e| GraphError::pynew(py, e))
     }
 
     def __iter__(&self) -> PyResult<Self> {
@@ -65,14 +65,13 @@ 
     def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision,
                 inclusive: bool) -> PyResult<AncestorsIterator> {
         let initvec = reviter_to_revvec(py, initrevs)?;
-        let ait = match CoreIterator::new(Index::new(py, index)?,
-                                          initvec, stoprev,
-                                          inclusive) {
-            Ok(ait) => ait,
-            Err(e) => {
-                return Err(GraphError::pynew(py, e));
-            }
-        };
+        let ait = CoreIterator::new(
+            Index::new(py, index)?,
+            initvec,
+            stoprev,
+            inclusive,
+        )
+        .map_err(|e| GraphError::pynew(py, e))?;
         AncestorsIterator::from_inner(py, ait)
     }