You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using an empty enum as source produces an unreachable_code warning. Which is certainly true, but should it do that? Sometimes you want to return a Result for forward compatibility or whatever.
use snafu::ResultExtas _;#[derive(Debug, snafu::Snafu)]enumOuter{Inner{source:Inner},}#[derive(Debug, snafu::Snafu)]enumInner{}fninfallible() -> Result<(),Inner>{Ok(())}fnmain() -> Result<(),Outer>{infallible().context(InnerSnafu)}
warning: unreachable expression
--> src/main.rs:3:17
|
3 | #[derive(Debug, snafu::Snafu)]
| ^^^^^^^^^^^^
| |
| unreachable expression
| any code following this expression is unreachable
|
note: this expression has type `Inner`, which is uninhabited
--> src/main.rs:3:17
|
3 | #[derive(Debug, snafu::Snafu)]
| ^^^^^^^^^^^^
= note: `#[warn(unreachable_code)]` on by default
= note: this warning originates in the derive macro `snafu::Snafu` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `snafu-unreachable` (bin "snafu-unreachable") generated 1 warning
The text was updated successfully, but these errors were encountered:
Using an empty enum as source produces an unreachable_code warning. Which is certainly true, but should it do that? Sometimes you want to return a Result for forward compatibility or whatever.
The text was updated successfully, but these errors were encountered: