Auto wrap of () in Ok() for functions returning Result<(), Error_Type>

This is closely related to try blocks, which have the auto-wrapping behavior you desire.

There have been a few different proposals for try fn or fn = try syntax that performs this wrapping at the function level, analogous to async fn.

The fehler crate implements a similar syntax as a macro.

Another somewhat relevant discussion recently: [Pre-RFC] `Result::void()` and `Option::void()`

5 Likes