rune icon indicating copy to clipboard operation
rune copied to clipboard

Add default `T=()` to `rune::Result`

Open ModProg opened this issue 2 years ago • 1 comments

Allows to do:

type Result<T = (), E = anyhow::Error> = core::result::Result<T, E>;

fn some_test -> Result {
    Ok(())
}

Though I also get not doing this, you really don't save much, but not having to say Result<()>.

ModProg avatar Aug 07 '23 08:08 ModProg

Might be a bit too unusual for my taste.

Strongest precedent I can think of is std::fmt::Result, but then it's set to exactly value. Even there it's a bit odd. 🤔

udoprog avatar Aug 07 '23 10:08 udoprog