diff --git a/src/fs-gen/src/image_builder.rs b/src/fs-gen/src/image_builder.rs index 6c5c67f..8d558ef 100644 --- a/src/fs-gen/src/image_builder.rs +++ b/src/fs-gen/src/image_builder.rs @@ -27,10 +27,12 @@ type BoxedLayer = Box + Send + Sync>; /// let passthrough_layer = new_passthroughfs_layer("/path/to/layer") /// ``` fn new_passthroughfs_layer(rootdir: &str) -> Result { - let mut config = passthrough::Config::default(); - config.root_dir = String::from(rootdir); - config.xattr = true; - config.do_import = true; + let config = passthrough::Config { + root_dir: String::from(rootdir), + xattr: true, + do_import: true, + ..Default::default() + }; let fs = Box::new(PassthroughFs::<()>::new(config)?); fs.import() .with_context(|| format!("Failed to create the passthrough layer: {}", rootdir))?; @@ -67,10 +69,12 @@ pub fn merge_layer(blob_paths: &[PathBuf], output_folder: &Path) -> Result<()> { ensure_folder_created(output_folder)?; // Setup the overlay fs config - let mut config = Config::default(); - config.work = "/work".into(); - config.mountpoint = output_folder.to_string_lossy().into(); - config.do_import = true; + let config = Config { + work: "/work".into(), + mountpoint: output_folder.to_string_lossy().into(), + do_import: true, + ..Default::default() + }; let fs = OverlayFs::new(None, lower_layers, config) .with_context(|| "Failed to construct the Overlay fs struct !".to_string())?; diff --git a/src/fs-gen/src/image_loader.rs b/src/fs-gen/src/image_loader.rs index 09c18a9..45c77bb 100644 --- a/src/fs-gen/src/image_loader.rs +++ b/src/fs-gen/src/image_loader.rs @@ -10,13 +10,13 @@ pub fn download_image_fs( output_file: PathBuf, ) -> Result, Box> { // Get image's name and tag - let image_and_tag: Vec<&str> = image_name.split(":").collect(); - let tag: &str; - if image_and_tag.len() < 2 { - tag = "latest" + let image_and_tag: Vec<&str> = image_name.split(':').collect(); + + let tag = if image_and_tag.len() < 2 { + "latest" } else { - tag = image_and_tag[1]; - } + image_and_tag[1] + }; let image_name = image_and_tag[0]; // Download image manifest @@ -81,7 +81,7 @@ fn download_manifest(image_name: &str, digest: &str) -> Result