diff options
author | Nadrieril | 2019-03-14 21:59:33 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-14 21:59:33 +0100 |
commit | 94023098bdadd38fcae6801048c8565efa893f59 (patch) | |
tree | 85107c15615007ff453a8ed3bb36aedec4a45343 | |
parent | bc1c40d670de0e37edf525fccd13a837b5983e7e (diff) |
rustfmt
Diffstat (limited to '')
-rw-r--r-- | dhall_core/src/core.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 8ce9715..ea23cbd 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -213,11 +213,17 @@ pub enum BorrowedInterpolatedTextContents<'a, Note, Embed> { Expr(&'a Expr<Note, Embed>), } -impl<'a, N: Clone + 'a, E: Clone + 'a> BorrowedInterpolatedTextContents<'a, N, E> { +impl<'a, N: Clone + 'a, E: Clone + 'a> + BorrowedInterpolatedTextContents<'a, N, E> +{ pub fn to_owned(self) -> OwnedInterpolatedTextContents<'a, N, E> { match self { - BorrowedInterpolatedTextContents::Text(s) => OwnedInterpolatedTextContents::Text(s), - BorrowedInterpolatedTextContents::Expr(e) => OwnedInterpolatedTextContents::Expr(e.clone()), + BorrowedInterpolatedTextContents::Text(s) => { + OwnedInterpolatedTextContents::Text(s) + } + BorrowedInterpolatedTextContents::Expr(e) => { + OwnedInterpolatedTextContents::Expr(e.clone()) + } } } } @@ -233,7 +239,9 @@ impl<N, E> InterpolatedText<N, E> { } } - pub fn iter(&self) -> impl Iterator<Item = BorrowedInterpolatedTextContents<N, E>> { + pub fn iter( + &self, + ) -> impl Iterator<Item = BorrowedInterpolatedTextContents<N, E>> { use std::iter::once; once(BorrowedInterpolatedTextContents::Text(self.head.as_ref())).chain( self.tail.iter().flat_map(|(e, s)| { @@ -275,7 +283,10 @@ impl<'a, N: Clone + 'a, E: Clone + 'a> impl<N: Clone, E: Clone> Add for InterpolatedText<N, E> { type Output = InterpolatedText<N, E>; fn add(self, rhs: InterpolatedText<N, E>) -> Self::Output { - self.iter().chain(rhs.iter()).map(BorrowedInterpolatedTextContents::to_owned).collect() + self.iter() + .chain(rhs.iter()) + .map(BorrowedInterpolatedTextContents::to_owned) + .collect() } } |