diff options
author | Nadrieril | 2019-04-20 11:21:28 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-20 11:21:28 +0200 |
commit | e8d1221a5f536d1d05d2bbaf176ec8e1cdc55295 (patch) | |
tree | ee3b55391fa697ae3d19477c6f1aa9ea9f6d891a /dhall_core | |
parent | a60cf58e5f0cc2f638b788720f9a12cabfdbe3f2 (diff) |
Text interpolation
Diffstat (limited to 'dhall_core')
-rw-r--r-- | dhall_core/src/text.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/dhall_core/src/text.rs b/dhall_core/src/text.rs index e886659..ff5c441 100644 --- a/dhall_core/src/text.rs +++ b/dhall_core/src/text.rs @@ -86,7 +86,7 @@ impl<SubExpr> InterpolatedText<SubExpr> { } } -impl<'a, SubExpr: 'a> FromIterator<InterpolatedTextContents<SubExpr>> +impl<SubExpr> FromIterator<InterpolatedTextContents<SubExpr>> for InterpolatedText<SubExpr> { fn from_iter<T>(iter: T) -> Self @@ -94,15 +94,15 @@ impl<'a, SubExpr: 'a> FromIterator<InterpolatedTextContents<SubExpr>> T: IntoIterator<Item = InterpolatedTextContents<SubExpr>>, { let mut res = InterpolatedText { - head: "".to_owned(), - tail: vec![], + head: String::new(), + tail: Vec::new(), }; let mut crnt_str = &mut res.head; for x in iter.into_iter() { match x { InterpolatedTextContents::Text(s) => crnt_str.push_str(&s), InterpolatedTextContents::Expr(e) => { - res.tail.push((e, "".to_owned())); + res.tail.push((e, String::new())); crnt_str = &mut res.tail.last_mut().unwrap().1; } } |