From 287b122694b98d1bdb65bb9048dbdf8e877fee7a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 3 Oct 2018 21:23:11 -0400 Subject: [PATCH] fixup! compose+rust: Parse includes via Rust too --- rust/src/treefile.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 50df8222f0..a0088097ec 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -172,10 +172,11 @@ fn merge_basic_field(dest: &mut Option, src: &mut Option) { /// Merge a vector field by appending. This semantic was originally designed for /// the `packages` key. fn merge_vec_field(dest: &mut Option>, src: &mut Option>) { - if let Some(ref mut srcv) = src.take() { - let mut v = dest.take().map_or_else(|| vec![], |v| v); - v.append(srcv); - *dest = Some(v) + if let Some(mut srcv) = src.take() { + if let Some(ref mut destv) = dest { + srcv.append(destv); + } + *dest = Some(srcv); } } @@ -195,6 +196,7 @@ fn treefile_merge(dest: &mut TreeComposeConfig, src: &mut TreeComposeConfig) { merge_vec_field(&mut dest.initramfs_args, &mut src.initramfs_args); merge_basic_field(&mut dest.boot_location, &mut src.boot_location); merge_basic_field(&mut dest.tmp_is_dir, &mut src.tmp_is_dir); + merge_basic_field(&mut dest.default_target, &mut src.default_target); merge_vec_field(&mut dest.units, &mut src.units); merge_basic_field(&mut dest.machineid_compat, &mut src.machineid_compat); merge_basic_field(&mut dest.releasever, &mut src.releasever);