-
Notifications
You must be signed in to change notification settings - Fork 138
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
Remove dependency on num_enum
.
#786
Conversation
These were suggested by `cargo udeps`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the proposal! I am in favor of removing these dependencies, I am just not sure about the current implementation hardcoding the values. Can we instead rely on the symbolic values, ala:
--- libbpf-rs/src/btf/mod.rs
+++ libbpf-rs/src/btf/mod.rs
@@ -96,7 +96,7 @@ impl TryFrom<u32> for BtfKind {
use BtfKind::*;
Ok(match value {
- 0 => Void,
+ x if x == Void as u32 => Void,
libbpf-rs/src/map.rs
Outdated
29 => TaskStorage, | ||
30 => BloomFilter, | ||
31 => UserRingBuf, | ||
u32::MAX => Unknown, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this case? What purpose does it serve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consistency with the "old" implementation, but to be fair it's useless, so I removed it
I think that's even better! I made the changes suggested. |
@danielocfb Thank you for taking the time to review! When you're happy with the PR I will squash the fixups away. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look great now! Feel free to squash and we can go ahead with the merge. Thanks!
Tests ensure that we didn't mess anything up.
Tests ensure that we didn't mess anything up.
Tests ensure that we didn't mess anything up.
Tests ensure that we didn't mess anything up.
Tests ensure that we didn't mess anything up.
It is unused.
These changes were suggested by clippy.
424e0f7
to
913357a
Compare
Squashed, and ready to go -- thank you! |
Hello!
I am using
libbpf-rs
in one of my personal projects and I noticed that I was pulling intoml-edit
vialibbpf-rs
which accounted for 1.3 seconds of my total build time. With the help ofcargo tree
I realized thatnum_enum
is pulling in that dependency (and many others!) and I decided to try to remove it fromlibbpf-rs
completely. Let me know what you think!cargo udeps
also noticed some extra things that can be removed, so I went ahead and removed those.