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

Allow deriving Dummy with generic types #155

Merged
merged 1 commit into from
Oct 25, 2023
Merged

Conversation

andrewtoth
Copy link
Contributor

@andrewtoth andrewtoth commented Oct 25, 2023

Currently this fails to compile with a cryptic error message:

#[derive(Dummy)]
struct MyStruct<T> {
    field: Vec<T>,
}
missing generics for struct `MyStruct`
expected 1 generic argument

This adds support for deriving Dummy trait on types with generics, provided the concrete type will implement Dummy as well. Otherwise the error message is more friendly. eg for a type NoDummyImpl:

let g: MyStruct<NoDummyImpl> = Faker.fake();
the trait bound `NoDummyImpl: fake::Dummy<fake::Faker>` is not satisfied

@cksac cksac merged commit b440b27 into cksac:master Oct 25, 2023
5 checks passed
@andrewtoth andrewtoth deleted the derive branch October 25, 2023 14:27
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

Successfully merging this pull request may close these issues.

2 participants