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 multiple bitflags structs in one macro invocation #235

Merged
merged 2 commits into from May 11, 2021

Conversation

konsumlamm
Copy link
Contributor

Add support for multiple bitflags structs in one macro invocation, for example:

bitflags! {
    pub struct Flags1: u32 {
        const A = 0b00000001;
    }

    struct Flags2: u32 {
        const B = 0b00000010;
    }
}

I also updated the documentation, replaced mentions of the flags keyword (which was used before 0.9) with struct and ran cargo fmt.

Change mentions of the `flags` keyword (used before 0.9) to `struct`
@KodrAus
Copy link
Member

KodrAus commented Jan 8, 2021

Thanks @konsumlamm! This looks like a nice quality-of-life improvement to me. I can't quite spot from the diff, do we still have any tests that create a single flags type? That seems like a case worth keeping.

@konsumlamm
Copy link
Contributor Author

I can't quite spot from the diff, do we still have any tests that create a single flags type? That seems like a case worth keeping.

Yes, there are still plenty tests that only create a single flags type, for example in line 1379 or line 1444 and the tests in test_suite all still use single flags types. It may be worth to add a test for the empty case (bitflags! {}), but that's just one line and there's not much there that could go wrong.

@konsumlamm
Copy link
Contributor Author

@KodrAus ?

@KodrAus
Copy link
Member

KodrAus commented May 11, 2021

Thanks for your patience on this one @konsumlamm. I had a bit of a break from things.

This looks good to me!

@KodrAus KodrAus merged commit bd24f9d into bitflags:master May 11, 2021
@konsumlamm konsumlamm deleted the multiple-bitflags branch May 11, 2021 09:50
@KodrAus KodrAus mentioned this pull request Aug 5, 2021
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

2 participants