Fix some clippy lints

This commit is contained in:
Nathan Fisher 2023-03-25 17:04:50 -04:00
parent 26af277e28
commit 9d53c9f44d
4 changed files with 25 additions and 25 deletions

View File

@ -33,8 +33,7 @@ fn create(matches: &ArgMatches) -> Result<(), Box<dyn Error>> {
let mut specs = if let Some(s) = matches.get_one::<String>("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()
};

View File

@ -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
};

View File

@ -69,18 +69,19 @@ pub struct Package {
impl From<Specs> 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<dyn Er
let mut archive = vec![];
let mut totalsize = 0;
while let Some(item) = items.pop() {
match &item.entry {
Entry::File {
path: _,
sha256sum: _,
mode: _,
size,
} => 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<dyn Er
let name = package.fullname();
let mut path = PathBuf::from(&name);
path.set_extension("tar.zst");
let mut outfile = outdir.to_path_buf();
let mut outfile = outdir;
outfile.push(path);
let fd = File::create(&outfile)?;
let mut writer = Encoder::new(fd, 0)?;

View File

@ -51,7 +51,7 @@ impl fmt::Display for Version {
}
Self::Git { hash, datetime } => {
let v = GitRev {
hash: hash.to_owned(),
hash: hash.clone(),
datetime: *datetime,
};
write!(f, "{v}")