From 03d0f6972f0d2af35c4cc1ab5d698cf846a5419f Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 19 Sep 2024 18:09:48 +0100 Subject: [PATCH] fmt --- src/assets.rs | 6 ++---- src/config.rs | 5 ++--- src/deb/control.rs | 11 +++++++---- src/lib.rs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/assets.rs b/src/assets.rs index 36f9245..3f813fd 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -1,7 +1,7 @@ -use crate::parse::manifest::CargoDebAssetArrayOrTable; use crate::config::{is_glob_pattern, PackageConfig}; use crate::error::{CDResult, CargoDebError}; use crate::listener::Listener; +use crate::parse::manifest::CargoDebAssetArrayOrTable; use crate::util::compress::gzipped; use crate::util::read_file_to_bytes; use std::borrow::Cow; @@ -86,8 +86,7 @@ pub(crate) struct Assets { pub resolved: Vec, } -#[derive(Debug, Clone)] -#[derive(serde::Deserialize)] +#[derive(Debug, Clone, serde::Deserialize)] #[serde(try_from = "CargoDebAssetArrayOrTable")] pub(crate) struct RawAsset { pub source_path: PathBuf, @@ -343,7 +342,6 @@ mod tests { use crate::util::tests::add_test_fs_paths; use crate::CargoLockingFlags; - #[test] fn assets() { let a = Asset::new( diff --git a/src/config.rs b/src/config.rs index 30d1c65..1654fef 100644 --- a/src/config.rs +++ b/src/config.rs @@ -8,7 +8,7 @@ use crate::error::{CDResult, CargoDebError}; use crate::listener::Listener; use crate::parse::cargo::CargoConfig; use crate::parse::manifest::{cargo_metadata, manifest_debug_flag, manifest_version_string, LicenseFile}; -use crate::parse::manifest::{CargoDeb, CargoMetadataTarget, CargoPackageMetadata, ManifestFound}; +use crate::parse::manifest::{CargoDeb, CargoDebAssetArrayOrTable, CargoMetadataTarget, CargoPackageMetadata, ManifestFound}; use crate::parse::manifest::{DependencyList, SystemUnitsSingleOrMultiple, SystemdUnitsConfig}; use crate::util::ok_or::OkOrThen; use crate::util::pathbytes::AsUnixPathBytes; @@ -755,7 +755,6 @@ impl PackageConfig { .collect() } - /// similar files next to each other improve tarball compression pub fn sort_assets_by_type(&mut self) { self.assets.resolved.sort_by(|a,b| { @@ -968,7 +967,7 @@ impl TryFrom for RawAsset { }, }; if a.source_path.starts_with("target/debug") { - return Err(format!("Packaging of development-only binaries is intentionally unsupported in cargo-deb. + return Err(format!("Packaging of development-only binaries is intentionally unsupported in cargo-deb. Please only use `target/release/` directory for built products, not `{}`. To add debug information or additional assertions use `[profile.release]` in `Cargo.toml` instead.", a.source_path.display())); } diff --git a/src/deb/control.rs b/src/deb/control.rs index 6a9e4ac..92eb430 100644 --- a/src/deb/control.rs +++ b/src/deb/control.rs @@ -101,7 +101,7 @@ impl<'l, W: Write> ControlArchiveBuilder<'l, W> { continue; } (read_file_to_bytes(&script_path)?, script_path.to_str()) - } + }, }; // The config, postinst, postrm, preinst, and prerm @@ -179,8 +179,8 @@ mod tests { use crate::parse::manifest::SystemdUnitsConfig; use crate::util::tests::{add_test_fs_paths, set_test_fs_path_content}; use crate::CargoLockingFlags; - use std::io::prelude::Read; use std::collections::HashMap; + use std::io::prelude::Read; use std::path::PathBuf; fn filename_from_path_str(path: &str) -> String { @@ -225,7 +225,8 @@ mod tests { Default::default(), None, None, - None, CargoLockingFlags::default(), + None, + CargoLockingFlags::default(), mock_listener, ) .unwrap(); @@ -306,7 +307,9 @@ mod tests { } // specify a path relative to the (root or workspace child) package - package_deb.maintainer_scripts_rel_path.get_or_insert(PathBuf::from("debian")); + package_deb + .maintainer_scripts_rel_path + .get_or_insert(PathBuf::from("debian")); // generate scripts and store them in the given archive in_ar.generate_scripts(&config, &package_deb).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index caaa4dc..63df6f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,7 +191,7 @@ pub struct CargoLockingFlags { impl CargoLockingFlags { #[inline] - pub(crate) fn flags(self) -> impl Iterator { + pub(crate) fn flags(self) -> impl Iterator { [ self.offline.then_some("--offline"), self.frozen.then_some("--frozen"),