Skip to content

Default Ok-type to () in anyhow::Result typedef #344

Closed
@emilk

Description

@emilk

WARNING: This issues is a matter of style and taste! :)

I have a lot of anyhow::Result<()> in my code base. I find it ugly.

If we change the definition of anyhow::Result from

pub type Result<T, E = Error> = core::result::Result<T, E>;

to

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

Then we could rewrite

fn foo() -> anyhow::Result<()> {}

to

fn foo() -> anyhow::Result {}

This would NOT be a breaking change (afaict).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions