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