Skip to content

Commit a570cc4

Browse files
committed
Improve Never documentation
1 parent 2c10355 commit a570cc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/std/src/never.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
/// where we want to ensure that no error is returned, such as
33
/// the `ibc_packet_receive` entry point.
44
///
5+
/// In contrast to `Empty`, this does not have a JSON schema
6+
/// and cannot be used for message and query types.
7+
///
58
/// Once the ! type is stable, this is not needed anymore.
69
/// See <https://github.com/rust-lang/rust/issues/35121>.
710
pub enum Never {}
811

12+
// The Debug implementation is needed to allow the use of `Result::unwrap`.
913
impl core::fmt::Debug for Never {
1014
fn fmt(&self, _f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1115
// This is unreachable because no instance of Never can exist
1216
unreachable!()
1317
}
1418
}
1519

20+
// The Display implementation is needed to fulfill the ToString requirement of
21+
// entry point errors: `Result<IbcReceiveResponse<C>, E>` with `E: ToString`.
1622
impl core::fmt::Display for Never {
1723
fn fmt(&self, _f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1824
// This is unreachable because no instance of Never can exist

0 commit comments

Comments
 (0)