- pub fn to_owned(&self) -> Sexp<'static, Loc> {
- match *self {
- Sexp::Sym(ref s, ref l) => Sexp::Sym(extend_cow(s), l.clone()),
- Sexp::Str(ref s, ref l) => Sexp::Str(extend_cow(s), l.clone()),
- Sexp::Char(c, ref l) => Sexp::Char(c, l.clone()),
- Sexp::Int(i, ref l) => Sexp::Int(i, l.clone()),
- Sexp::Float(f, ref l) => Sexp::Float(f, l.clone()),
- Sexp::List(ref xs, ref l) => {
- Sexp::List(xs.iter().map(Sexp::to_owned).collect(), l.clone())
- }
+ pub fn to_owned(&self) -> Sexp<'static, Loc::Owned> {
+ match self {
+ Sexp::Sym(s, l) => Sexp::Sym(extend_cow(s), l.to_owned()),
+ Sexp::Str(s, l) => Sexp::Str(extend_cow(s), l.to_owned()),
+ Sexp::Char(c, l) => Sexp::Char(*c, l.to_owned()),
+ Sexp::Int(i, l) => Sexp::Int(*i, l.to_owned()),
+ Sexp::Float(f, l) => Sexp::Float(*f, l.to_owned()),
+ Sexp::List(xs, l) => Sexp::List(
+ xs.iter().map(Sexp::to_owned).collect(),
+ l.to_owned(),
+ ),