diff --git a/src/changelog.rs b/src/changelog.rs index 4cc42e9..7dfbe2f 100644 --- a/src/changelog.rs +++ b/src/changelog.rs @@ -170,13 +170,8 @@ pub fn parse_changelog_footer(path: &Path) -> Result<(String, String), Box Date) let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?; diff --git a/src/context/mod.rs b/src/context/mod.rs index cd1c412..3d8db4f 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -168,10 +168,7 @@ mod tests { ctx.copy_path(&src_dir, &dest_dir).unwrap(); // The regular file was copied. - assert_eq!( - ctx.read_file(&dest_dir.join("real.txt")).unwrap(), - "data" - ); + assert_eq!(ctx.read_file(&dest_dir.join("real.txt")).unwrap(), "data"); // The symlink was reproduced as a symlink (not followed). let meta = std::fs::symlink_metadata(dest_dir.join("dangling")).unwrap(); assert!(meta.file_type().is_symlink()); diff --git a/src/context/unshare.rs b/src/context/unshare.rs index bc6f2b0..81afaa0 100644 --- a/src/context/unshare.rs +++ b/src/context/unshare.rs @@ -48,12 +48,8 @@ fn copy_dir_recursive(src: &Path, dest: &Path) -> io::Result<()> { Err(e) => { return Err(io::Error::new( e.kind(), - format!( - "Failed to read metadata of '{}': {}", - src_path.display(), - e - ), - )) + format!("Failed to read metadata of '{}': {}", src_path.display(), e), + )); } }; diff --git a/src/deb/local.rs b/src/deb/local.rs index 23d684d..9c5480f 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -148,12 +148,10 @@ pub async fn build( ) })?; if !status.success() { - return Err( - "apt-get update failed inside the build context. \ + return Err("apt-get update failed inside the build context. \ If this is a local build, try executing with sudo, \ or re-run with RUST_LOG=debug for more details." - .into(), - ); + .into()); } // Install essential packages diff --git a/src/distro_info.rs b/src/distro_info.rs index cbb9d32..7663c35 100644 --- a/src/distro_info.rs +++ b/src/distro_info.rs @@ -126,14 +126,13 @@ pub async fn get_ordered_series(dist: &str) -> Result, Bo })?; let series_info = &dist_data.series; let content = if Path::new(series_info.local.as_str()).exists() { - std::fs::read_to_string(format!("/usr/share/distro-info/{dist}.csv")) - .map_err(|e| { - format!( - "Failed to read distribution series data for '{dist}' \ + std::fs::read_to_string(format!("/usr/share/distro-info/{dist}.csv")).map_err(|e| { + format!( + "Failed to read distribution series data for '{dist}' \ from '{}': {}. The 'distro-info' package provides these CSV files.", - series_info.local, e - ) - })? + series_info.local, e + ) + })? } else { reqwest::get(series_info.network.as_str()) .await? @@ -237,7 +236,8 @@ pub fn get_sources_url(base_url: &str, series: &str, pocket: &str, component: &s /// /// Example: ubuntu => http://archive.ubuntu.com/ubuntu pub fn get_base_url(dist: &str) -> Result> { - DATA.dist.get(dist) + DATA.dist + .get(dist) .map(|d| d.base_url.clone()) .ok_or_else(|| { format!( @@ -281,15 +281,13 @@ pub async fn get_keyring_urls(series: &str) -> Result, Box Result, Bo })?; let series_info = &dist_data.series; let content = if Path::new(series_info.local.as_str()).exists() { - std::fs::read_to_string(series_info.local.as_str()) - .map_err(|e| { - format!( - "Failed to read Debian series data from '{}': {}. \ + std::fs::read_to_string(series_info.local.as_str()).map_err(|e| { + format!( + "Failed to read Debian series data from '{}': {}. \ The 'distro-info' package provides this file.", - series_info.local, e - ) - })? + series_info.local, e + ) + })? } else { reqwest::get(series_info.network.as_str()) .await? diff --git a/src/main.rs b/src/main.rs index 910a518..ee57a01 100644 --- a/src/main.rs +++ b/src/main.rs @@ -247,9 +247,8 @@ fn main() { let context = match type_str { "local" => ContextConfig::Local, "ssh" => { - let endpoint = args - .get_one::("endpoint") - .unwrap_or_else(|| { + let endpoint = + args.get_one::("endpoint").unwrap_or_else(|| { error!( "An --endpoint is required to create an ssh context. \ Expected format: [ssh://][user@]host[:port]" diff --git a/src/pull.rs b/src/pull.rs index c715583..d2bd3c7 100644 --- a/src/pull.rs +++ b/src/pull.rs @@ -104,7 +104,10 @@ fn copy_dir_all(src: &Path, dst: &Path) -> Result<(), Box> { // Reproduce symlinks as symlinks rather than following them, so that // dangling/absolute symlinks do not abort the copy. - if std::fs::symlink_metadata(&src_path)?.file_type().is_symlink() { + if std::fs::symlink_metadata(&src_path)? + .file_type() + .is_symlink() + { let target = std::fs::read_link(&src_path)?; let _ = std::fs::remove_file(&dst_path); symlink(&target, &dst_path)?;