##// END OF EJS Templates
cleanup: simplify code
Arseniy Alekseyev -
r51430:6a019a03 default
parent child Browse files
Show More
@@ -54,16 +54,11 b' py_class!(pub class Dirs |py| {'
54 54 def addpath(&self, path: PyObject) -> PyResult<PyObject> {
55 55 self.inner(py).borrow_mut().add_path(
56 56 HgPath::new(path.extract::<PyBytes>(py)?.data(py)),
57 ).and(Ok(py.None())).or_else(|e| {
58 match e {
59 e => {
60 Err(PyErr::new::<exc::ValueError, _>(
57 ).and(Ok(py.None())).map_err(|e| PyErr::new::<exc::ValueError, _>(
61 58 py,
62 59 e.to_string(),
63 ))
64 }
65 }
66 })
60 )
61 )
67 62 }
68 63
69 64 def delpath(&self, path: PyObject) -> PyResult<PyObject> {
@@ -71,16 +66,12 b' py_class!(pub class Dirs |py| {'
71 66 HgPath::new(path.extract::<PyBytes>(py)?.data(py)),
72 67 )
73 68 .and(Ok(py.None()))
74 .or_else(|e| {
75 match e {
76 e => {
77 Err(PyErr::new::<exc::ValueError, _>(
69 .map_err(|e|
70 PyErr::new::<exc::ValueError, _>(
78 71 py,
79 72 e.to_string(),
80 ))
81 }
82 }
83 })
73 )
74 )
84 75 }
85 76 def __iter__(&self) -> PyResult<DirsMultisetKeysIterator> {
86 77 let leaked_ref = self.inner(py).leak_immutable();
General Comments 0
You need to be logged in to leave comments. Login now