Skip to content

Commit

Permalink
rust-agent: Remove or rename unused parameters
Browse files Browse the repository at this point in the history
Parameters that are never used were removed.
Parameters that are unused, but necessary because of some common
interface were renamed with a _ prefix.
In one case, consume the parameter by adding an info! call, and fix a
minor typo in a message in the same function.

This addresses the following warning:

    warning: unused variable: `child`
        --> rustjail/src/container.rs:1128:5
         |
    1128 |     child: &mut Child,
         |     ^^^^^ help: if this is intentional, prefix it with an underscore: `_child`

    warning: unused variable: `logger`
        --> rustjail/src/container.rs:1049:22
         |
    1049 | fn update_namespaces(logger: &Logger, spec: &mut Spec, init_pid: RawFd) -> Result<()> {
         |                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_logger`

Fixes: #750

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
  • Loading branch information
c3d committed Oct 7, 2020
1 parent 5a1d331 commit f832d8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/agent/rustjail/src/cgroups/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl CgroupManager for Manager {
}

fn set_network_resources(
cg: &cgroups::Cgroup,
_cg: &cgroups::Cgroup,
network: &LinuxNetwork,
res: &mut cgroups::Resources,
) -> Result<()> {
Expand Down Expand Up @@ -259,7 +259,7 @@ fn set_network_resources(
}

fn set_devices_resources(
cg: &cgroups::Cgroup,
_cg: &cgroups::Cgroup,
device_resources: &Vec<LinuxDeviceCgroup>,
res: &mut cgroups::Resources,
) -> Result<()> {
Expand Down Expand Up @@ -288,7 +288,7 @@ fn set_devices_resources(
}

fn set_hugepages_resources(
cg: &cgroups::Cgroup,
_cg: &cgroups::Cgroup,
hugepage_limits: &Vec<LinuxHugepageLimit>,
res: &mut cgroups::Resources,
) -> Result<()> {
Expand Down
5 changes: 2 additions & 3 deletions src/agent/rustjail/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,6 @@ impl BaseContainer for LinuxContainer {
&p,
self.cgroup_manager.as_ref().unwrap(),
&st,
&mut child,
pwfd,
prfd,
) {
Expand Down Expand Up @@ -1039,8 +1038,9 @@ fn do_exec(args: &[String]) -> ! {
}

fn update_namespaces(logger: &Logger, spec: &mut Spec, init_pid: RawFd) -> Result<()> {
info!(logger, "updating namespaces");
let linux = match spec.linux.as_mut() {
None => return Err(anyhow!("Spec didn't container linux field")),
None => return Err(anyhow!("Spec didn't contain linux field")),
Some(l) => l,
};

Expand Down Expand Up @@ -1117,7 +1117,6 @@ fn join_namespaces(
p: &Process,
cm: &FsManager,
st: &OCIState,
_child: &mut Child,
pwfd: RawFd,
prfd: RawFd,
) -> Result<()> {
Expand Down

0 comments on commit f832d8a

Please sign in to comment.