Skip to content

Commit

Permalink
clean up warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jtk18 authored and cat-in-136 committed Mar 6, 2021
1 parent 98c41a0 commit 0942824
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ impl Config {
.package
.as_ref()
.ok_or(ConfigError::Missing("package"))?;
let name = get_str_from_metadata!("name").unwrap_or(pkg.name.as_str());
let version = get_str_from_metadata!("version").unwrap_or(pkg.version.as_str());
let name = get_str_from_metadata!("name").unwrap_or_else(||pkg.name.as_str());
let version = get_str_from_metadata!("version").unwrap_or_else(||pkg.version.as_str());
let license = get_str_from_metadata!("license").unwrap_or(
pkg.license
.as_ref()
.ok_or(ConfigError::Missing("package.license"))?
.as_str(),
);
let arch = target_arch.unwrap_or(
let arch = target_arch.unwrap_or_else(||
match ARCH {
"x86" => "i586",
"arm" => "armhfp",
Expand Down Expand Up @@ -252,7 +252,7 @@ impl Config {
]
.iter()
.find(|v| v.exists())
.ok_or(ConfigError::AssetFileNotFound(file.source.to_string()))?
.ok_or_else(||ConfigError::AssetFileNotFound(file.source.to_string()))?
.to_owned();

builder = builder.with_file(file_source, options)?;
Expand Down
1 change: 0 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use rpm::RPMError;
use std::ffi::OsString;
use std::io::Error as IoError;
use std::path::PathBuf;
use thiserror;

#[derive(thiserror::Error, Debug, Clone)]
pub enum ConfigError {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn parse_arg() -> Result<(Option<String>, Option<PathBuf>, Option<String>, AutoR
std::process::exit(0);
}
let target_arch = opt_matches.opt_str("a");
let target_file = opt_matches.opt_str("o").map(|v| PathBuf::from(v));
let target_file = opt_matches.opt_str("o").map(PathBuf::from);
let package = opt_matches.opt_str("p");
let auto_req_mode = AutoReqMode::try_from(
opt_matches
Expand Down

0 comments on commit 0942824

Please sign in to comment.