aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2021-06-06 19:57:26 +0200
committerTeddy Wing2021-06-06 19:57:26 +0200
commit352a486fee986118a2865316d2d1ab8e6de69b48 (patch)
tree109fe546566d46567f21e3f38ac536df9e8b9992 /src
parent304441d496f9d0b04095b56e377d869f41eb38cd (diff)
downloadreflectub-352a486fee986118a2865316d2d1ab8e6de69b48.tar.bz2
main: Remove `unwrap` when parsing `--skip-larger-than`
Don't panic here so we can use our own error message template.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index af1319d..b0474bf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -77,14 +77,16 @@ fn run() -> anyhow::Result<()> {
let mirror_root = &opt_matches.free[1];
let max_repo_size_bytes = opt_matches.opt_str("skip-larger-than")
- .map(|s|
- parse_size(&s)
- .with_context(|| format!(
- "unable to parse max file size '{}'",
- s
- ))
- .unwrap()
- );
+ .map_or(
+ Ok(None),
+ |s|
+ parse_size(&s)
+ .map(|s| Some(s))
+ .with_context(|| format!(
+ "unable to parse max file size '{}'",
+ s
+ ))
+ )?;
let base_cgitrc = opt_matches.opt_str("cgitrc")
.map(|s| PathBuf::from(s));