Make clippy happy

This commit is contained in:
Roey Darwish Dror 2020-06-17 19:39:58 +00:00
parent c04b5f5559
commit b3449b6b3d
3 changed files with 6 additions and 8 deletions

View File

@ -225,7 +225,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
packages.extend(presets.packages); packages.extend(presets.packages);
if presets.aur_packages.len() > 0 { if !presets.aur_packages.is_empty() {
packages.extend(constants::AUR_DEPENDENCIES.iter().map(|s| String::from(*s))); packages.extend(constants::AUR_DEPENDENCIES.iter().map(|s| String::from(*s)));
} }
@ -249,7 +249,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
); );
debug!("fstab:\n{}", fstab); debug!("fstab:\n{}", fstab);
fs::write(mount_point.path().join("etc/fstab"), fstab).context("fstab error")?; fs::write(mount_point.path().join("etc/fstab"), fstab).context("fstab error")?;
if presets.aur_packages.len() > 0 { if !presets.aur_packages.is_empty() {
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())

View File

@ -22,10 +22,8 @@ fn visit_dirs(dir: &Path, filevec: &mut Vec<PathBuf>) -> Result<(), io::Error> {
let path = entry.path(); let path = entry.path();
if path.is_dir() { if path.is_dir() {
visit_dirs(&path, filevec)?; visit_dirs(&path, filevec)?;
} else { } else if entry.path().extension() == Some(&std::ffi::OsString::from("toml")) {
if entry.path().extension() == Some(&std::ffi::OsString::from("toml")) { filevec.push(entry.path());
filevec.push(entry.path());
}
} }
} }
} }

View File

@ -13,7 +13,7 @@ impl CommandExt for Command {
let exit_status = self.spawn()?.wait()?; let exit_status = self.spawn()?.wait()?;
if !exit_status.success() { if !exit_status.success() {
Err(anyhow!("Bad exit code: {}", exit_status))?; return Err(anyhow!("Bad exit code: {}", exit_status));
} }
Ok(()) Ok(())
@ -25,7 +25,7 @@ impl CommandExt for Command {
if !output.status.success() { if !output.status.success() {
let error = str::from_utf8(&output.stderr).unwrap_or("[INVALID UTF8]"); let error = str::from_utf8(&output.stderr).unwrap_or("[INVALID UTF8]");
error!("{}", error); error!("{}", error);
Err(anyhow!("Bad exit code: {}", output.status))?; return Err(anyhow!("Bad exit code: {}", output.status));
} }
Ok(String::from(str::from_utf8(&output.stdout).map_err( Ok(String::from(str::from_utf8(&output.stdout).map_err(