diff --git a/src/hpk.rs b/src/hpk.rs index 87eda3c..47a2bd3 100644 --- a/src/hpk.rs +++ b/src/hpk.rs @@ -33,8 +33,7 @@ fn create(matches: &ArgMatches) -> Result<(), Box> { let mut specs = if let Some(s) = matches.get_one::("specs") { let path = PathBuf::from(s.to_string()); let fd = File::open(path)?; - let specs = ron::de::from_reader(fd)?; - specs + ron::de::from_reader(fd)? } else { Specs::default() }; diff --git a/src/item/mod.rs b/src/item/mod.rs index 5ed1f33..cef089a 100644 --- a/src/item/mod.rs +++ b/src/item/mod.rs @@ -67,7 +67,7 @@ impl Item { fn fix_path(path: &Path) -> PathBuf { let path = if let Ok(p) = path.strip_prefix("./") { - &p + p } else { path }; diff --git a/src/package/mod.rs b/src/package/mod.rs index 0f8cef7..b3e1f1b 100644 --- a/src/package/mod.rs +++ b/src/package/mod.rs @@ -69,18 +69,19 @@ pub struct Package { impl From for Package { fn from(value: Specs) -> Self { - let mut package = Package::default(); - package.name = value.name; - package.version = value.version; - package.release = value.release; - package.description = value.description; - package.long_description = value.long_description; - package.appstream_data = value.appstream_data; - package.dependencies = value.dependencies; - package.users = value.users; - package.groups = value.groups; - package.post_install = value.post_install; - package + Package { + name: value.name, + version: value.version, + release: value.release, + description: value.description, + long_description: value.long_description, + appstream_data: value.appstream_data, + dependencies: value.dependencies, + users: value.users, + groups: value.groups, + post_install: value.post_install, + ..Default::default() + } } } @@ -133,14 +134,14 @@ pub fn create(path: &Path, specs: Specs, outdir: &Path) -> Result<(), Box totalsize += size, - _ => {} + if let Entry::File { + path: _, + sha256sum: _, + mode: _, + size, + } = &item.entry + { + totalsize += size; } plist.entries.push(item.entry); archive.extend(item.data); @@ -153,7 +154,7 @@ pub fn create(path: &Path, specs: Specs, outdir: &Path) -> Result<(), Box { let v = GitRev { - hash: hash.to_owned(), + hash: hash.clone(), datetime: *datetime, }; write!(f, "{v}")