# HG changeset patch # User Georges Racinet # Date 1546952433 -3600 # Node ID 1b4b94bac8a0224931fe8b8e67a7c9b08798f33d # Parent 5ac61ca58c3faaf4d72fcedadd5a0ea617bdae91 rust-cpython: style consistency leftovers In particular, during review of `LazyAncestors` bindings, most `match` statements for error conversion have been replaced by higher level methods of `Result` and most personal insecurity comments have been removed. This makes it more systematic. Differential Revision: https://phab.mercurial-scm.org/D5548 diff -r 5ac61ca58c3f -r 1b4b94bac8a0 rust/hg-cpython/src/ancestors.rs --- a/rust/hg-cpython/src/ancestors.rs Tue Jan 08 13:54:01 2019 +0100 +++ b/rust/hg-cpython/src/ancestors.rs Tue Jan 08 14:00:33 2019 +0100 @@ -43,7 +43,6 @@ } py_class!(pub class AncestorsIterator |py| { - // TODO RW lock ? data inner: RefCell>>; def __next__(&self) -> PyResult> { @@ -55,7 +54,8 @@ } def __contains__(&self, rev: Revision) -> PyResult { - 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 { @@ -65,14 +65,13 @@ def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision, inclusive: bool) -> PyResult { 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) }