refactor: simplify config processing

This commit is contained in:
2022-04-07 20:47:47 +02:00
parent b7a7abbf61
commit 80e3d02cb4

View File

@@ -288,15 +288,8 @@ pub fn config() -> Result<Config> {
.context("Could not canonicalize \"to\" path")?, .context("Could not canonicalize \"to\" path")?,
matches: transcode_matches, matches: transcode_matches,
jobs: arg_matches jobs: arg_matches
.value_of_os("jobs") .value_of("jobs")
.map(|jobs_os_str| { .map(|jobs_str| {
let jobs_str = jobs_os_str.to_str().with_context(|| {
// TODO: use `OsStr.display` when it lands
// https://github.com/rust-lang/rust/pull/80841
format!(
"Could not convert \"jobs\" argument to string due to invalid characters",
)
})?;
jobs_str.parse().with_context(|| { jobs_str.parse().with_context(|| {
format!( format!(
"Could not parse \"jobs\" argument \"{}\" to a number", "Could not parse \"jobs\" argument \"{}\" to a number",