rust-agent: Remove or rename unused parameters

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>
This commit is contained in:
Christophe de Dinechin 2020-09-17 18:55:22 +02:00
parent 5a1d331135
commit f832d8a651
2 changed files with 5 additions and 6 deletions

View File

@ -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<()> {
@ -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<()> {
@ -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<()> {

View File

@ -888,7 +888,6 @@ impl BaseContainer for LinuxContainer {
&p,
self.cgroup_manager.as_ref().unwrap(),
&st,
&mut child,
pwfd,
prfd,
) {
@ -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,
};
@ -1117,7 +1117,6 @@ fn join_namespaces(
p: &Process,
cm: &FsManager,
st: &OCIState,
_child: &mut Child,
pwfd: RawFd,
prfd: RawFd,
) -> Result<()> {