Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Sep 19, 2024
1 parent e35af2b commit 03d0f69
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/assets.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -86,8 +86,7 @@ pub(crate) struct Assets {
pub resolved: Vec<Asset>,
}

#[derive(Debug, Clone)]
#[derive(serde::Deserialize)]
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(try_from = "CargoDebAssetArrayOrTable")]
pub(crate) struct RawAsset {
pub source_path: PathBuf,
Expand Down Expand Up @@ -343,7 +342,6 @@ mod tests {
use crate::util::tests::add_test_fs_paths;
use crate::CargoLockingFlags;


#[test]
fn assets() {
let a = Asset::new(
Expand Down
5 changes: 2 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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| {
Expand Down Expand Up @@ -968,7 +967,7 @@ impl TryFrom<CargoDebAssetArrayOrTable> 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()));
}
Expand Down
11 changes: 7 additions & 4 deletions src/deb/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -225,7 +225,8 @@ mod tests {
Default::default(),
None,
None,
None, CargoLockingFlags::default(),
None,
CargoLockingFlags::default(),
mock_listener,
)
.unwrap();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub struct CargoLockingFlags {

impl CargoLockingFlags {
#[inline]
pub(crate) fn flags(self) -> impl Iterator<Item=&'static str> {
pub(crate) fn flags(self) -> impl Iterator<Item = &'static str> {
[
self.offline.then_some("--offline"),
self.frozen.then_some("--frozen"),
Expand Down

0 comments on commit 03d0f69

Please sign in to comment.