Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support syn::Pat::Wild pattern in method signatures #21

Open
girstenbrei opened this issue Dec 28, 2023 · 0 comments
Open

Support syn::Pat::Wild pattern in method signatures #21

girstenbrei opened this issue Dec 28, 2023 · 0 comments

Comments

@girstenbrei
Copy link

This issue relevant after #20 merges, but is not a result of the PR.

Assuming #20, the following fails to compile:

enum Abort {
    Yes,
    No,
}

#[trait_variant::make(Example: Send)]
trait LocalExample {
    async fn should_abort(_: String) -> Abort {
        Abort::No
    }
}

The reason is the unsupported pattern _, tracing back to this error:

_ => Error::new_spanned(pat, "patterns are not supported in arguments")

Giving the variable a name is possible, of course, but leads to the slight inconvenience of requiring allow(clippy::no_effect_underscore_binding) and allow(clippy::used_underscore_binding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant