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

Generate #[must_use] on functions returing a typedef to a must-use-type #2206

Conversation

ian-h-chamberlain
Copy link
Contributor

Closes #2186

I added a test case that uses aliased builtin types and structs, as well as some extra checks just to ensure the underlying types aren't being marked #[must_use].

This is my first contribution to bindgen so please let me know if I should change anything re: code style, naming conventions, etc.! I did my best to follow the existing conventions that I found.

The #[must_use] attribute does not need to be generated for functions
returning a type that already has #[must_use] on it. Stop generating the
extraneous attribute to restore previous behavior.
Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you. I think it'd be ok actually to just generate the couple extra #[must_use], it simplifies the code quite a bit. I've pushed this with your changes squashed and a minor clean-up. Thanks!

@emilio emilio closed this in 3a8a60c Jun 5, 2022
aatifsyed pushed a commit to aatifsyed/rust-bindgen that referenced this pull request Sep 22, 2022
LoganBarnett pushed a commit to LoganBarnett/rust-bindgen that referenced this pull request Dec 2, 2023
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.

must_use_type not working on type aliases
2 participants