Skip to content

Commit

Permalink
Avoid a function-scoped function and make it inline
Browse files Browse the repository at this point in the history
  • Loading branch information
udzura committed Dec 1, 2022
1 parent 25d918d commit 5652b7c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions crates/youki/src/commands/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,18 @@ pub fn print_namespaces() {
}
}

#[inline]
fn get_cap_supported(caps: &caps::CapsHashSet, cap: caps::Capability) -> &'static str {
if caps.contains(&cap) {
"available"
} else {
"unsupported"
}
}

pub fn print_capabilities() {
println!("Capabilities");
if let Ok(current) = caps::read(None, caps::CapSet::Bounding) {
fn get_cap_supported(caps: &caps::CapsHashSet, cap: caps::Capability) -> &'static str {
if caps.contains(&cap) {
"available"
} else {
"unsupported"
}
}

println!(
"{:<17} {}",
"CAP_BPF",
Expand Down

0 comments on commit 5652b7c

Please sign in to comment.