--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs Wed May 31 19:00:11 2023 +0100
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs Thu Jun 01 12:05:32 2023 +0100
@@ -54,16 +54,11 @@
def addpath(&self, path: PyObject) -> PyResult<PyObject> {
self.inner(py).borrow_mut().add_path(
HgPath::new(path.extract::<PyBytes>(py)?.data(py)),
- ).and(Ok(py.None())).or_else(|e| {
- match e {
- e => {
- Err(PyErr::new::<exc::ValueError, _>(
+ ).and(Ok(py.None())).map_err(|e| PyErr::new::<exc::ValueError, _>(
py,
e.to_string(),
- ))
- }
- }
- })
+ )
+ )
}
def delpath(&self, path: PyObject) -> PyResult<PyObject> {
@@ -71,16 +66,12 @@
HgPath::new(path.extract::<PyBytes>(py)?.data(py)),
)
.and(Ok(py.None()))
- .or_else(|e| {
- match e {
- e => {
- Err(PyErr::new::<exc::ValueError, _>(
+ .map_err(|e|
+ PyErr::new::<exc::ValueError, _>(
py,
e.to_string(),
- ))
- }
- }
- })
+ )
+ )
}
def __iter__(&self) -> PyResult<DirsMultisetKeysIterator> {
let leaked_ref = self.inner(py).leak_immutable();