I've implemented embedded_hal::serial::Write in my code. In my case, errors can only be returned on receive, so Error is !, as per the recommendation in the documentation.
I've temporarily replaced the code in my old (blocking) write method with this:
block!(<Self as Write<u8>>::write(self, data))
.expect("Write operation should never result in error");
This results in the following warnings:
warning: unreachable expression
--> src/uart.rs:151:9
|
151 | block!(<Self as Write<u8>>::write(self, data))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_code)] on by default
= note: this error originates in a macro outside of the current crate
warning: unreachable pattern
--> src/uart.rs:151:9
|
151 | block!(<Self as Write<u8>>::write(self, data))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_patterns)] on by default
= note: this error originates in a macro outside of the current crate
I've implemented
embedded_hal::serial::Write
in my code. In my case, errors can only be returned on receive, soError
is!
, as per the recommendation in the documentation.I've temporarily replaced the code in my old (blocking) write method with this:
This results in the following warnings:
If I change
Error
to()
, the warnings disappear.