D6394: rust-dirstate: add "dirs" rust-cpython binding
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Sat Jun 29 23:41:02 EDT 2019
yuja added a comment.
> + def __contains__(&self, item: PyObject) -> PyResult<bool> {
> + Ok(self
> + .dirs_map(py)
> + .borrow()
> + .get(&item.extract::<PyBytes>(py)?.data(py).to_owned())
> + .is_some())
`.contains_key(..)` and `.as_ref()` instead of `&...to_owned()`.
I'm surprised by the use of Deref in the previous patch. Is it legit
to leverage Deref to expose the inner type?
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D6394/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D6394
To: Alphare, #hg-reviewers, kevincox
Cc: yuja, durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list