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 libcgroups/examples/bpf.rs #1499

Closed
krisnova opened this issue Jan 21, 2023 · 7 comments · Fixed by #1877
Closed

Fix libcgroups/examples/bpf.rs #1499

krisnova opened this issue Jan 21, 2023 · 7 comments · Fixed by #1877
Assignees
Labels
good first issue Good for newcomers

Comments

@krisnova
Copy link
Contributor

krisnova commented Jan 21, 2023

In #1483 we discovered bpf.rs fails clippy check.

cargo clippy --all-targets --all-features -- -D warnings

How to reproduce

Please add the example back to libcgroups/Cargo.toml and address clippy errors from example.

diff --git a/crates/libcgroups/Cargo.toml b/crates/libcgroups/Cargo.toml
index 3f91762d..b3e20a78 100644
--- a/crates/libcgroups/Cargo.toml
+++ b/crates/libcgroups/Cargo.toml
@@ -9,7 +9,7 @@ readme = "README.md"
 authors = ["youki team"]
 edition = "2021"
 rust-version = "1.58.1"
-autoexamples = false
+autoexamples = true
 keywords = ["youki", "container", "cgroups"]

 [features]

and run

$ cargo clippy --all-targets --all-features -- -D warnings
@utam0k utam0k added the good first issue Good for newcomers label Jan 22, 2023
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Jan 23, 2023

Hey, I checked with main branch and this does not fail. If this was introduced in #1483 , we should try to resolve it in that, instead of creating an issue.
However, I did find

error: useless conversion to the same type: `u32`
   --> crates/libcontainer/src/syscall/linux.rs:377:44
    |
377 |         let res = unsafe { libc::setrlimit((rlimit.typ() as u32).try_into().unwrap(), rlim) };
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider removing `.try_into()`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `-D clippy::useless-conversion` implied by `-D warnings`

error: could not compile `libcontainer` due to previous error

Can someone else validate this?

@yihuaf
Copy link
Collaborator

yihuaf commented Feb 28, 2023

I don't see this line and the commit is 17 months ago. I see:

 let res = unsafe { libc::setrlimit(rlimit.typ() as u32, rlim) };

@yihuaf
Copy link
Collaborator

yihuaf commented Feb 28, 2023

I can also confirm that on main branch today, the clippy passes the check.

@utam0k
Copy link
Member

utam0k commented Mar 7, 2023

I can also confirm that on main branch today, the clippy passes the check.

What version did you use?

@yihuaf
Copy link
Collaborator

yihuaf commented Mar 8, 2023

I can also confirm that on main branch today, the clippy passes the check.

What version did you use?

$ cargo clippy --version
clippy 0.1.67 (fc594f1 2023-01-24)

@utam0k
Copy link
Member

utam0k commented May 2, 2023

@yihuaf Sorry for the late reply. Are you still getting this error?

@yihuaf
Copy link
Collaborator

yihuaf commented May 3, 2023

I did not get this error. On my dev box, I don't see this error, so I suspect we can close this issue until it pops up again.

Actually, I just realize we need to turn the autoexamples = true. I am able to reproduce this. Fix incoming.

@yihuaf yihuaf self-assigned this May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants