Skip to content

Commit daa949e

Browse files
author
Jorge Aparicio
committed
libsyntax: DSTify ToSource and ToSourceWithHygiene
1 parent 38c17dc commit daa949e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ pub mod rt {
9090
*/
9191

9292
// FIXME: Move this trait to pprust and get rid of *_to_str?
93-
pub trait ToSource {
93+
pub trait ToSource for Sized? {
9494
// Takes a thing and generates a string containing rust code for it.
9595
fn to_source(&self) -> String;
9696
}
9797

9898
// FIXME (Issue #16472): This should go away after ToToken impls
9999
// are revised to go directly to token-trees.
100-
trait ToSourceWithHygiene : ToSource {
100+
trait ToSourceWithHygiene for Sized? : ToSource {
101101
// Takes a thing and generates a string containing rust code
102102
// for it, encoding Idents as special byte sequences to
103103
// maintain hygiene across serialization and deserialization.
@@ -150,15 +150,15 @@ pub mod rt {
150150

151151
macro_rules! impl_to_source_slice(
152152
($t:ty, $sep:expr) => (
153-
impl<'a> ToSource for &'a [$t] {
153+
impl ToSource for [$t] {
154154
fn to_source(&self) -> String {
155-
slice_to_source($sep, *self)
155+
slice_to_source($sep, self)
156156
}
157157
}
158158

159-
impl<'a> ToSourceWithHygiene for &'a [$t] {
159+
impl ToSourceWithHygiene for [$t] {
160160
fn to_source_with_hygiene(&self) -> String {
161-
slice_to_source_with_hygiene($sep, *self)
161+
slice_to_source_with_hygiene($sep, self)
162162
}
163163
}
164164
)
@@ -200,14 +200,14 @@ pub mod rt {
200200
}
201201
}
202202

203-
impl<'a> ToSource for &'a str {
203+
impl ToSource for str {
204204
fn to_source(&self) -> String {
205205
let lit = dummy_spanned(ast::LitStr(
206-
token::intern_and_get_ident(*self), ast::CookedStr));
206+
token::intern_and_get_ident(self), ast::CookedStr));
207207
pprust::lit_to_string(&lit)
208208
}
209209
}
210-
impl<'a> ToSourceWithHygiene for &'a str {
210+
impl ToSourceWithHygiene for str {
211211
fn to_source_with_hygiene(&self) -> String {
212212
self.to_source()
213213
}

0 commit comments

Comments
 (0)