From a229957482903654c859660425d2bf4e1981275c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 2 Jan 2021 16:03:17 +0100 Subject: Shorten code Signed-off-by: Matthias Beyer --- src/main.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 80eec21..8f123dc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,12 +132,7 @@ fn hash_map_targets<'a>(c : &'a Config, targets : Vec) /// splits the target and return the capture name part fn cname_from_target<'a>(t : &'a String) -> Result { - Ok( - t.split('.') - .nth(1) - .ok_or(Error::from("no capture name found"))? - .into() - ) + t.split('.').nth(1).map(str::to_string).ok_or(Error::from("no capture name found").into()) } /// Iterate the hashmap created with the above function -- cgit v1.2.3