Skip to content

libbpf-rs: minor fixes suggested by linter #1153

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

Merged
merged 2 commits into from
Apr 11, 2025

Conversation

theihor
Copy link
Contributor

@theihor theihor commented Apr 10, 2025

@theihor theihor force-pushed the clippy-fixes branch 3 times, most recently from 156393e to 8d916ce Compare April 10, 2025 22:52
@theihor theihor requested a review from d-e-s-o April 10, 2025 22:56
@@ -630,7 +630,7 @@ impl<'btf> BtfType<'btf> {
let int = types::Int::try_from(skipped).unwrap();
Ok(Ord::min(
ptr_size,
NonZeroUsize::new(((int.bits + 7) / 8).into()).unwrap(),
NonZeroUsize::new(usize::from(int.bits.div_ceil(8))).unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

int.bits.div_ceil(8).into() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's explicit vs implicit cast, right? With into() the type is figured out by compiler?

Anyways...

Copy link
Member

Choose a reason for hiding this comment

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

yes, and I've seen Daniel using .into() everywhere, which is why I'm pointing this out, this seems to be more idiomatic

@anakryiko
Copy link
Member

thanks for quick fixes! back to green!

@anakryiko anakryiko merged commit e89cb68 into libbpf:master Apr 11, 2025
14 checks passed
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.

2 participants