From 66bed8dbc7249e17a89adcbb19406f4126a434de Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 8 Mar 2019 22:37:32 +0100 Subject: Finally get rid of all the &'i str --- dhall_core/src/core.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'dhall_core/src') diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 343c631..2465629 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -269,7 +269,7 @@ pub enum Builtin { } pub trait StringLike: - Display + fmt::Debug + Clone + Hash + Ord + Eq + Into + Default + Display + fmt::Debug + Clone + Hash + Ord + Eq + Into + Default + From { } @@ -281,7 +281,7 @@ impl StringLike for T where + Ord + Eq + Into - + Default + + Default + From { } @@ -358,13 +358,13 @@ impl Expr_ { } } -// impl<'i, S: Clone, A: Clone> Expr_<&'i str, S, A> { -// pub fn to_owned(&self) -> Expr_ { -// let recurse = -// |e: &Expr_<&'i str, S, A>| -> Expr_ { e.to_owned() }; -// self.map_shallow(recurse, |x| x.clone(), |x| x.clone(), |x| x.to_owned()) -// } -// } +impl<'i, S: Clone, A: Clone> Expr_<&'i str, S, A> { + pub fn take_ownership_of_labels>(&self) -> Expr_ { + let recurse = + |e: &Expr_<&'i str, S, A>| -> Expr_ { e.take_ownership_of_labels() }; + map_shallow(self, recurse, |x| x.clone(), |x| x.clone(), |x: &&str| -> L { (*x).to_owned().into() }) + } +} // There is a one-to-one correspondence between the formatters in this section // and the grammar in grammar.lalrpop. Each formatter is named after the @@ -759,7 +759,7 @@ where A: Clone, S: Clone, T: Clone, - Label1: StringLike, + Label1: Display + fmt::Debug + Clone + Hash + Ord + Eq + Into + Default, Label2: StringLike, F1: Fn(&Expr_) -> Expr_, F2: FnOnce(&S) -> T, -- cgit v1.2.3