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:10:25 +0100
commita229957482903654c859660425d2bf4e1981275c (patch)
tree48cea42b9cdd378f94beae41bbb38671586f97e2
parentfea94045f83486a26bbfe5d81f779325729cbdb5 (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