From 1a50e905148a78beaef6253c090c9d1dc2fc1625 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 20 Nov 2022 22:10:41 +0100 Subject: [PATCH] remove unnecessary assignment. --- src/main.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index c61a858..f13e096 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,12 +11,9 @@ fn main() { if separators.contains(&c) { '_' } else { - let x = c.to_lowercase().next(); - x.expect(&format!( - "Error: couldn't convert character to lowercase: `{}`", - c - )); - x.unwrap() + c.to_lowercase().next().unwrap_or_else(|| { + panic!("Error: couldn't convert character to lowercase: `{}`", c) + }) } }) .collect();