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 clippy lints #3087

Merged
merged 1 commit into from
Jan 6, 2025
Merged

Fix clippy lints #3087

merged 1 commit into from
Jan 6, 2025

Conversation

mkrasnitski
Copy link
Collaborator

Fixes borked CI

@github-actions github-actions bot added model Related to the `model` module. http Related to the `http` module. labels Jan 5, 2025
@mkrasnitski
Copy link
Collaborator Author

Any insight as to why adding #[repr(Rust)] breaks typesize? @GnomedDev

@mkrasnitski
Copy link
Collaborator Author

mkrasnitski commented Jan 5, 2025

My guess is that typesize processes#[repr(packed)]correctly but #[repr(Rust, packed)] is not. Compare the generated code for the first case:

impl ::typesize::TypeSize for Permissions {
    fn extra_size(&self) -> usize {
        ({
            let __typesize_internal_temp = self.0;
            ::typesize::TypeSize::extra_size(&__typesize_internal_temp)
        })
    }
    fn get_size_details(&self) -> Vec<::typesize::Field> {
        <[_]>::into_vec(
            #[rustc_box]
            ::alloc::boxed::Box::new([
                ::typesize::Field {
                    name: "0usize",
                    size: ({
                        let __typesize_internal_temp = self.0;
                        ::typesize::TypeSize::get_size(&__typesize_internal_temp)
                    }),
                    collection_items: ({
                        let __typesize_internal_temp = self.0;
                        ::typesize::TypeSize::get_collection_item_count(
                            &__typesize_internal_temp,
                        )
                    }),
                },
            ]),
        )
    }
}

with the second case:

impl ::typesize::TypeSize for Permissions {
    fn extra_size(&self) -> usize {
        ::typesize::TypeSize::extra_size(&self.0)
    }
    fn get_size_details(&self) -> Vec<::typesize::Field> {
        <[_]>::into_vec(
            #[rustc_box]
            ::alloc::boxed::Box::new([
                ::typesize::Field {
                    name: "0usize",
                    size: ::typesize::TypeSize::get_size(&self.0),
                    collection_items: ::typesize::TypeSize::get_collection_item_count(
                        &self.0,
                    ),
                },
            ]),
        )
    }
}

@GnomedDev
Copy link
Member

I know the problem, I'm working on it now and will release a new typesize version which fixes this today.

@GnomedDev
Copy link
Member

A new release is out which fixes this.

@arqunis arqunis added the enhancement An improvement to Serenity. label Jan 5, 2025
@mkrasnitski
Copy link
Collaborator Author

CI passes now

@arqunis arqunis merged commit 5a46f1f into serenity-rs:current Jan 6, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to Serenity. http Related to the `http` module. model Related to the `model` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants