mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 23:39:30 +00:00
genpolicy: fix clippy v1.78.0 warnings
cargo clippy has two new warnings that need addressing: - assigning_clones These were fixed by clippy itself. - suspicious_open_options I added truncate(false) because we're opening the file for reading. Signed-off-by: Markus Rudy <mr@edgeless.systems>
This commit is contained in:
@@ -57,8 +57,8 @@ pub fn get_policy_mounts(
|
||||
.find(|m| m.destination.eq(&s_mount.destination))
|
||||
{
|
||||
// Update an already existing mount.
|
||||
policy_mount.type_ = mount.type_.clone();
|
||||
policy_mount.source = mount.source.clone();
|
||||
policy_mount.type_.clone_from(&mount.type_);
|
||||
policy_mount.source.clone_from(&mount.source);
|
||||
policy_mount.options = mount.options.iter().map(String::from).collect();
|
||||
} else {
|
||||
// Add a new mount.
|
||||
@@ -94,7 +94,7 @@ fn keep_settings_mount(
|
||||
fn adjust_termination_path(mount: &mut policy::KataMount, yaml_container: &pod::Container) {
|
||||
if mount.destination == "/dev/termination-log" {
|
||||
if let Some(path) = &yaml_container.terminationMessagePath {
|
||||
mount.destination = path.clone();
|
||||
mount.destination.clone_from(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -570,10 +570,12 @@ impl AgentPolicy {
|
||||
linux.Namespaces = get_kata_namespaces(is_pause_container, use_host_network);
|
||||
|
||||
if !c_settings.Linux.MaskedPaths.is_empty() {
|
||||
linux.MaskedPaths = c_settings.Linux.MaskedPaths.clone();
|
||||
linux.MaskedPaths.clone_from(&c_settings.Linux.MaskedPaths);
|
||||
}
|
||||
if !c_settings.Linux.ReadonlyPaths.is_empty() {
|
||||
linux.ReadonlyPaths = c_settings.Linux.ReadonlyPaths.clone();
|
||||
linux
|
||||
.ReadonlyPaths
|
||||
.clone_from(&c_settings.Linux.ReadonlyPaths);
|
||||
}
|
||||
|
||||
let sandbox_pidns = if is_pause_container {
|
||||
@@ -722,7 +724,7 @@ fn get_image_layer_storages(
|
||||
"previous_chain_id = {}, chain_id = {}",
|
||||
&previous_chain_id, &chain_id
|
||||
);
|
||||
previous_chain_id = chain_id.clone();
|
||||
previous_chain_id.clone_from(&chain_id);
|
||||
|
||||
layer_names.push(name_to_hash(&chain_id));
|
||||
layer_hashes.push(layer.verity_hash.to_string());
|
||||
|
@@ -215,7 +215,7 @@ impl Container {
|
||||
|
||||
if let Some(working_dir) = &docker_config.WorkingDir {
|
||||
if !working_dir.is_empty() {
|
||||
process.Cwd = working_dir.clone();
|
||||
process.Cwd.clone_from(working_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,6 +344,7 @@ pub fn add_verity_to_store(cache_file: &str, diff_id: &str, verity_hash: &str) -
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(false)
|
||||
.open(cache_file)?;
|
||||
|
||||
let mut data: Vec<ImageLayer> = if let Ok(vec) = serde_json::from_reader(read_file) {
|
||||
|
Reference in New Issue
Block a user