mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 03:13:23 +00:00
Use clone_from
in OSDK instead of assigning clones
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
b4a357a971
commit
ee740020d0
@ -50,7 +50,7 @@ impl Build {
|
|||||||
pub fn apply_common_args(&mut self, common_args: &CommonArgs) {
|
pub fn apply_common_args(&mut self, common_args: &CommonArgs) {
|
||||||
let build_args = &common_args.build_args;
|
let build_args = &common_args.build_args;
|
||||||
if let Some(profile) = build_args.profile() {
|
if let Some(profile) = build_args.profile() {
|
||||||
self.profile = profile.clone();
|
self.profile.clone_from(&profile);
|
||||||
}
|
}
|
||||||
self.features.extend(build_args.features.clone());
|
self.features.extend(build_args.features.clone());
|
||||||
self.override_configs
|
self.override_configs
|
||||||
@ -67,7 +67,7 @@ impl Build {
|
|||||||
impl BuildScheme {
|
impl BuildScheme {
|
||||||
pub fn inherit(&mut self, parent: &Self) {
|
pub fn inherit(&mut self, parent: &Self) {
|
||||||
if self.profile.is_none() {
|
if self.profile.is_none() {
|
||||||
self.profile = parent.profile.clone();
|
self.profile.clone_from(&parent.profile);
|
||||||
}
|
}
|
||||||
self.features = {
|
self.features = {
|
||||||
let mut features = parent.features.clone();
|
let mut features = parent.features.clone();
|
||||||
|
@ -60,7 +60,7 @@ impl BootScheme {
|
|||||||
init_args
|
init_args
|
||||||
};
|
};
|
||||||
if self.initramfs.is_none() {
|
if self.initramfs.is_none() {
|
||||||
self.initramfs = from.initramfs.clone();
|
self.initramfs.clone_from(&from.initramfs);
|
||||||
}
|
}
|
||||||
if self.method.is_none() {
|
if self.method.is_none() {
|
||||||
self.method = from.method;
|
self.method = from.method;
|
||||||
|
@ -43,7 +43,7 @@ impl Default for Grub {
|
|||||||
impl GrubScheme {
|
impl GrubScheme {
|
||||||
pub fn inherit(&mut self, from: &Self) {
|
pub fn inherit(&mut self, from: &Self) {
|
||||||
if self.grub_mkrescue.is_none() {
|
if self.grub_mkrescue.is_none() {
|
||||||
self.grub_mkrescue = from.grub_mkrescue.clone();
|
self.grub_mkrescue.clone_from(&from.grub_mkrescue);
|
||||||
}
|
}
|
||||||
if self.boot_protocol.is_none() {
|
if self.boot_protocol.is_none() {
|
||||||
self.boot_protocol = from.boot_protocol;
|
self.boot_protocol = from.boot_protocol;
|
||||||
|
@ -69,17 +69,17 @@ impl Scheme {
|
|||||||
if let Some(qemu) = &mut self.qemu {
|
if let Some(qemu) = &mut self.qemu {
|
||||||
if let Some(from_qemu) = &from.qemu {
|
if let Some(from_qemu) = &from.qemu {
|
||||||
if qemu.args.is_none() {
|
if qemu.args.is_none() {
|
||||||
qemu.args = from_qemu.args.clone();
|
qemu.args.clone_from(&from_qemu.args);
|
||||||
self.work_dir = from.work_dir.clone();
|
self.work_dir.clone_from(&from.work_dir);
|
||||||
}
|
}
|
||||||
if qemu.path.is_none() {
|
if qemu.path.is_none() {
|
||||||
qemu.path = from_qemu.path.clone();
|
qemu.path.clone_from(&from_qemu.path);
|
||||||
self.work_dir = from.work_dir.clone();
|
self.work_dir.clone_from(&from.work_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.qemu = from.qemu.clone();
|
self.qemu.clone_from(&from.qemu);
|
||||||
self.work_dir = from.work_dir.clone();
|
self.work_dir.clone_from(&from.work_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,10 @@ impl Qemu {
|
|||||||
impl QemuScheme {
|
impl QemuScheme {
|
||||||
pub fn inherit(&mut self, from: &Self) {
|
pub fn inherit(&mut self, from: &Self) {
|
||||||
if self.args.is_none() {
|
if self.args.is_none() {
|
||||||
self.args = from.args.clone();
|
self.args.clone_from(&from.args);
|
||||||
}
|
}
|
||||||
if self.path.is_none() {
|
if self.path.is_none() {
|
||||||
self.path = from.path.clone();
|
self.path.clone_from(&from.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user