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

fix(derive): Use fully qualified types #3092

Merged
merged 1 commit into from
Dec 8, 2021
Merged

fix(derive): Use fully qualified types #3092

merged 1 commit into from
Dec 8, 2021

Conversation

janikrabe
Copy link
Contributor

This fixes #[derive(Parser)] when a custom Result type is in scope.

For example, this code fails to compile without this patch:

use clap::Parser;

type Result<T> = result::Result<T, ()>;

#[derive(Parser)]
pub struct Options {}

This fixes `#[derive(Parser)]` when a custom `Result` type is in scope.
@janikrabe
Copy link
Contributor Author

@sanpii was faster #3091. My PR also updates an Option in dummies.rs. I believe this code is only emitted when compilation has already failed but it might be a good idea to qualify the type anyway to make sure the error message isn't more confusing than it needs to be.

@epage
Copy link
Member

epage commented Dec 8, 2021

Thanks!

@epage epage merged commit 2cb0bbf into clap-rs:master Dec 8, 2021
@pksunkara
Copy link
Member

@epage We might want to mention about this derive's contributing doc.

@epage
Copy link
Member

epage commented Dec 9, 2021

An rc.1 is now released

(and contributing doc was updated)

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.

None yet

3 participants