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

This could be done with C++ style generic consts (as opposed to const generics):

const OK<E>: Result<(), E> = Ok(());

The same could be achieved if associated consts could be imported with use:

impl<E> Result<(), E> {
    pub const OK: Self = Self::Ok(());
}

// somewhere downstream...
use Result::OK;

fn foo() -> Result<(), Error> {
    OK
}
5 Likes