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

large size difference between variants #121

Open
progval opened this issue Apr 20, 2024 · 1 comment
Open

large size difference between variants #121

progval opened this issue Apr 20, 2024 · 1 comment

Comments

@progval
Copy link
Collaborator

progval commented Apr 20, 2024

Clippy points out these issues:

warning: large size difference between variants
  --> sable_network/src/network/update.rs:34:1
   |
34 | / pub enum HistoricMessageSource {
35 | |     Server(state::Server),
   | |     --------------------- the second-largest variant contains at least 128 bytes
36 | |     User(HistoricUser),
   | |     ------------------ the largest variant contains at least 656 bytes
37 | |     Unknown,
38 | | }
   | |_^ the entire enum is at least 656 bytes
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
   = note: `#[warn(clippy::large_enum_variant)]` on by default
help: consider boxing the large fields to reduce the total size of the enum
   |
36 |     User(Box<HistoricUser>),
   |          ~~~~~~~~~~~~~~~~~

warning: large size difference between variants
  --> sable_network/src/network/update.rs:54:1
   |
54 | / pub enum HistoricMessageTarget {
55 | |     User(HistoricUser),
   | |     ------------------ the largest variant contains at least 656 bytes
56 | |     Channel(state::Channel),
   | |     ----------------------- the second-largest variant contains at least 176 bytes
57 | |     Unknown,
58 | | }
   | |_^ the entire enum is at least 656 bytes
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
   |
55 |     User(Box<HistoricUser>),
   |          ~~~~~~~~~~~~~~~~~

warning: `sable_network` (lib) generated 2 warnings

Should we do something about them?

@spb
Copy link
Collaborator

spb commented Apr 20, 2024

We should, but it's part of rewriting that entire mechanism of the history log. No need for a spot fix just yet.

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

No branches or pull requests

2 participants