Skip to content

Commit 42cc262

Browse files
committed
libkrun: fix clippy warnings
Fix code to remove clippy warnings. Signed-off-by: Sergio Lopez <slp@redhat.com>
1 parent aefafd5 commit 42cc262

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/libkrun/src/lib.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ pub unsafe extern "C" fn krun_set_mapped_volumes(
338338
Ok(s) => s,
339339
Err(_) => return -libc::EINVAL,
340340
};
341-
let vol_tuple: Vec<&str> = s.split(":").collect();
341+
let vol_tuple: Vec<&str> = s.split(':').collect();
342342
if vol_tuple.len() != 2 {
343343
return -libc::EINVAL;
344344
}
@@ -363,7 +363,7 @@ pub unsafe extern "C" fn krun_set_mapped_volumes(
363363
let fs_device_config = match cfg.get_fs_cfg() {
364364
Some(fs_cfg) => FsDeviceConfig {
365365
fs_id: fs_cfg.fs_id.clone(),
366-
shared_dir: fs_cfg.shared_dir.clone(),
366+
shared_dir: fs_cfg.shared_dir,
367367
mapped_volumes: Some(mapped_volumes),
368368
},
369369
None => FsDeviceConfig {
@@ -423,7 +423,7 @@ pub unsafe extern "C" fn krun_set_port_map(ctx_id: u32, c_port_map: *const *cons
423423
Ok(s) => s,
424424
Err(_) => return -libc::EINVAL,
425425
};
426-
let port_tuple: Vec<&str> = s.split(":").collect();
426+
let port_tuple: Vec<&str> = s.split(':').collect();
427427
if port_tuple.len() != 2 {
428428
return -libc::EINVAL;
429429
}
@@ -485,7 +485,7 @@ pub unsafe extern "C" fn krun_set_rlimits(ctx_id: u32, c_rlimits: *const *const
485485

486486
match CTX_MAP.lock().unwrap().entry(ctx_id) {
487487
Entry::Occupied(mut ctx_cfg) => {
488-
ctx_cfg.get_mut().set_rlimits(rlimits.to_string());
488+
ctx_cfg.get_mut().set_rlimits(rlimits);
489489
}
490490
Entry::Vacant(_) => return -libc::ENOENT,
491491
}
@@ -646,17 +646,18 @@ pub extern "C" fn krun_start_enter(ctx_id: u32) -> i32 {
646646
ctx_cfg.vmr.set_attestation_url(url);
647647
}
648648

649-
let mut boot_source = BootSourceConfig::default();
650-
boot_source.kernel_cmdline_prolog = Some(format!(
651-
"{} init={} KRUN_INIT={} KRUN_WORKDIR={} {} {}",
652-
DEFAULT_KERNEL_CMDLINE,
653-
INIT_PATH,
654-
ctx_cfg.get_exec_path(),
655-
ctx_cfg.get_workdir(),
656-
ctx_cfg.get_rlimits(),
657-
ctx_cfg.get_env(),
658-
));
659-
boot_source.kernel_cmdline_epilog = Some(format!(" -- {}", ctx_cfg.get_args()));
649+
let boot_source = BootSourceConfig {
650+
kernel_cmdline_prolog: Some(format!(
651+
"{} init={} KRUN_INIT={} KRUN_WORKDIR={} {} {}",
652+
DEFAULT_KERNEL_CMDLINE,
653+
INIT_PATH,
654+
ctx_cfg.get_exec_path(),
655+
ctx_cfg.get_workdir(),
656+
ctx_cfg.get_rlimits(),
657+
ctx_cfg.get_env(),
658+
)),
659+
kernel_cmdline_epilog: Some(format!(" -- {}", ctx_cfg.get_args())),
660+
};
660661

661662
if ctx_cfg.vmr.set_boot_source(boot_source).is_err() {
662663
return -libc::EINVAL;

0 commit comments

Comments
 (0)