D5550: rust-cpython: bindings for MissingAncestors

kevincox (Kevin Cox) phabricator at mercurial-scm.org
Sat Jan 12 06:30:56 EST 2019


kevincox added inline comments.

INLINE COMMENTS

> ancestors.rs:170
> +            bases_vec.push(rev.to_py_object(py).into_object());
> +        }
> +        Ok(PyTuple::new(py, bases_vec.as_slice()))

This could be a `.collect()` call. Something like:

  let bases_vec: Vec<PyObject> = bases_set.into_iter()
      .map(|rev| rev.to_py_object(py).into_object())
      .collect();

> ancestors.rs:193
> +            remaining_pyint_vec.push(rev.to_py_object(py).into_object());
> +        }
> +        let remaining_pylist = PyList::new(py, remaining_pyint_vec.as_slice());

This could also be a `collect()`.

> ancestors.rs:204
> +            Err(e) => {
> +                return Err(GraphError::pynew(py, e));
> +            }

This match can become a `.map_error(|e| GraphError::pynew(py, e))?`

> ancestors.rs:212
> +            missing_pyint_vec.push(rev.to_py_object(py).into_object());
> +        }
> +        Ok(PyList::new(py, missing_pyint_vec.as_slice()))

This can also be a `.collect()`

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list