Skip to content

Commit 222689b

Browse files
committed
Remove unnecessary match
1 parent 3daba2c commit 222689b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/singledispatch/core.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ struct SingleDispatchState {
7575
impl SingleDispatchState {
7676
fn find_impl(&mut self, py: Python, cls: Bound<'_, PyAny>) -> PyResult<PyObject> {
7777
let cls_mro = get_obj_mro(&cls.clone())?;
78-
let mro = match compose_mro(py, cls.clone(), self.registry.keys()) {
79-
Ok(mro) => mro,
80-
Err(e) => return Err(e),
81-
};
78+
let mro = compose_mro(py, cls.clone(), self.registry.keys())?;
8279
let mut mro_match: Option<PyTypeReference> = None;
8380
eprintln!("Finding impl for {cls}");
8481
for typ in mro.iter() {
@@ -136,10 +133,7 @@ impl SingleDispatchState {
136133
None => {
137134
let handler_for_cls = match self.registry.get(&type_reference) {
138135
Some(handler) => handler.clone_ref(py),
139-
None => match self.find_impl(py, free_cls.bind(py).clone()) {
140-
Ok(handler) => handler,
141-
Err(e) => return Err(e),
142-
},
136+
None => self.find_impl(py, free_cls.bind(py).clone())?,
143137
};
144138
self.cache
145139
.insert(type_reference, handler_for_cls.clone_ref(py));

0 commit comments

Comments
 (0)