aboutsummaryrefslogtreecommitdiff
path: root/src/ast/container.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast/container.rs')
-rw-r--r--src/ast/container.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/ast/container.rs b/src/ast/container.rs
index 46c548b..fe4f949 100644
--- a/src/ast/container.rs
+++ b/src/ast/container.rs
@@ -199,18 +199,14 @@ impl Ast {
// If the Gemtext line starts with an "=" ("=>"), it is a link line,
// so splitting it up should be easy enough.
let line = line.get(2..).unwrap_or("");
- let mut split = line
- .split_whitespace()
- .map(String::from)
- .collect::<Vec<String>>()
- .into_iter();
+ let mut split = line.split_whitespace();
nodes.push(Node::Link {
- to: split.next().unwrap_or_default(),
+ to: split.next().unwrap_or_default().to_string(),
text: {
- let rest = split.collect::<Vec<String>>().join(" ");
+ let rest: Vec<&str> = split.collect();
- if rest.is_empty() { None } else { Some(rest) }
+ if rest.is_empty() { None } else { Some(rest.join(" ")) }
},
});