Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
  • Loading branch information
guni1192 committed Sep 12, 2021
1 parent ecf3370 commit 05e7831
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cgroups/src/v1/blkio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Controller for Blkio {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply blkio cgroup config");

if let Some(blkio) = Self::needs_to_handle(&controller_opt) {
if let Some(blkio) = Self::needs_to_handle(controller_opt) {
Self::apply(cgroup_root, blkio)?;
}

Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Controller for Cpu {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply Cpu cgroup config");

if let Some(cpu) = Self::needs_to_handle(&controller_opt) {
if let Some(cpu) = Self::needs_to_handle(controller_opt) {
Self::apply(cgroup_root, cpu).context("failed to apply cpu resource restrictions")?;
}

Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/cpuset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Controller for CpuSet {
fn apply(controller_opt: &ControllerOpt, cgroup_path: &Path) -> Result<()> {
log::debug!("Apply CpuSet cgroup config");

if let Some(cpuset) = Self::needs_to_handle(&controller_opt) {
if let Some(cpuset) = Self::needs_to_handle(controller_opt) {
Self::apply(cgroup_path, cpuset)
.context("failed to apply cpuset resource restrictions")?;
}
Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod tests {
},
LinuxDeviceCgroup {
allow: true,
typ: Some(LinuxDeviceType::B),
typ: Some(LinuxDeviceType::A),
major: None,
minor: Some(200),
access: "rwm".to_string().into(),
Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/freezer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Controller for Freezer {
log::debug!("Apply Freezer cgroup config");
create_dir_all(&cgroup_root)?;

if let Some(freezer_state) = Self::needs_to_handle(&controller_opt) {
if let Some(freezer_state) = Self::needs_to_handle(controller_opt) {
Self::apply(freezer_state, cgroup_root).context("failed to appyl freezer")?;
}

Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/hugetlb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Controller for HugeTlb {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &std::path::Path) -> Result<()> {
log::debug!("Apply Hugetlb cgroup config");

if let Some(hugepage_limits) = Self::needs_to_handle(&controller_opt) {
if let Some(hugepage_limits) = Self::needs_to_handle(controller_opt) {
for hugetlb in hugepage_limits {
Self::apply(cgroup_root, hugetlb)
.context("failed to apply hugetlb resource restrictions")?
Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl CgroupManager for Manager {
}

fn apply(&self, controller_opt: &ControllerOpt) -> Result<()> {
for subsys in self.get_required_controllers(&controller_opt)? {
for subsys in self.get_required_controllers(controller_opt)? {
match subsys.0 {
CtrlType::Cpu => Cpu::apply(controller_opt, subsys.1)?,
CtrlType::CpuAcct => CpuAcct::apply(controller_opt, subsys.1)?,
Expand Down
6 changes: 3 additions & 3 deletions cgroups/src/v1/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Controller for Memory {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply Memory cgroup config");

if let Some(memory) = Self::needs_to_handle(&controller_opt) {
if let Some(memory) = Self::needs_to_handle(controller_opt) {
let reservation = memory.reservation.unwrap_or(0);

Self::apply(memory, cgroup_root)?;
Expand Down Expand Up @@ -440,7 +440,7 @@ mod tests {


// clone to avoid use of moved value later on
let memory_limits = linux_memory.clone();
let memory_limits = linux_memory;

let linux_resources = LinuxResources {
devices: Some(vec![]),
Expand All @@ -456,7 +456,7 @@ mod tests {

let controller_opt = ControllerOpt {
resources: linux_resources,
disable_oom_killer: disable_oom_killer,
disable_oom_killer,
..Default::default()
};

Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/network_classifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Controller for NetworkClassifier {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply NetworkClassifier cgroup config");

if let Some(network) = Self::needs_to_handle(&controller_opt) {
if let Some(network) = Self::needs_to_handle(controller_opt) {
Self::apply(cgroup_root, network)
.context("failed to apply network classifier resource restrictions")?;
}
Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v1/network_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Controller for NetworkPriority {
fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply NetworkPriority cgroup config");

if let Some(network) = Self::needs_to_handle(&controller_opt) {
if let Some(network) = Self::needs_to_handle(controller_opt) {
Self::apply(cgroup_root, network)
.context("failed to apply network priority resource restrictions")?;
}
Expand Down
2 changes: 1 addition & 1 deletion cgroups/src/v2/devices/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fn bpf_cgroup_dev_ctx(
mod tests {
use super::*;

fn build_bpf_program(rules: &Option<Vec<oci_spec::LinuxDeviceCgroup>>) -> Result<Program> {
fn build_bpf_program(rules: &Option<Vec<LinuxDeviceCgroup>>) -> Result<Program> {
let mut em = crate::v2::devices::emulator::Emulator::with_default_allow(false);
if let Some(rules) = rules {
em.add_rules(rules)?;
Expand Down
6 changes: 3 additions & 3 deletions cgroups/src/v2/unified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
};

let controller_opt = ControllerOpt {
resources: resources,
resources,
..Default::default()
};

Expand Down Expand Up @@ -112,7 +112,7 @@ mod tests {
};

let controller_opt = ControllerOpt {
resources: resources,
resources,
..Default::default()
};

Expand Down Expand Up @@ -143,7 +143,7 @@ mod tests {
};

let controller_opt = ControllerOpt {
resources: resources,
resources,
..Default::default()
};

Expand Down

0 comments on commit 05e7831

Please sign in to comment.