feat(conditions): use if let ... conditions instead match

This commit is contained in:
doryan 2025-02-14 00:09:48 +04:00
parent 18a3368565
commit b1dd7eea9d

View File

@ -169,8 +169,11 @@ impl<const L: usize> UsbDevice<L> {
let usb = self.usb.borrow(cs);
let current_endpoint = self.ep_table[endpoint_index];
match self.select_endpoint(cs, endpoint_index) {
Ok(_) => {
let select_endpoint_result = self.select_endpoint(cs, endpoint_index);
if select_endpoint_result.is_err() {
select_endpoint_result
} else {
// Enable endpoint. //
usb.ueconx.modify(|_, w| w.epen().set_bit());
@ -200,10 +203,8 @@ impl<const L: usize> UsbDevice<L> {
usb.ueienx
.modify(|_, w| w.rxoute().set_bit().rxstpe().set_bit());
Ok(())
select_endpoint_result
}
}
Err(exception) => Err(exception),
}
}
}