summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-01-02 16:03:17 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-01-02 16:13:39 +0100
commit525e93e2661f60e4d972753cc6c7b7d4a05abed4 (patch)
tree48cea42b9cdd378f94beae41bbb38671586f97e2
parent7de257458e4e7a5a2da174a84470d70a7490c137 (diff)
Shorten code
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/main.rs7
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