diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-01-02 16:03:17 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-01-02 16:10:25 +0100 |
commit | a229957482903654c859660425d2bf4e1981275c (patch) | |
tree | 48cea42b9cdd378f94beae41bbb38671586f97e2 | |
parent | fea94045f83486a26bbfe5d81f779325729cbdb5 (diff) |
Shorten code
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 1 insertions, 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<Target>) /// splits the target and return the capture name part fn cname_from_target<'a>(t : &'a String) -> Result<String> { - 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 |