Skip to content

Commit a720d9f

Browse files
committed
Remove use of From when a newtype variant constructor suffices
1 parent 13092b8 commit a720d9f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/wrapper.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ impl From<fallback::TokenStream> for TokenStream {
161161
// Assumes inside_proc_macro().
162162
fn into_compiler_token(token: TokenTree) -> proc_macro::TokenTree {
163163
match token {
164-
TokenTree::Group(tt) => proc_macro::TokenTree::from(tt.inner.unwrap_nightly()),
164+
TokenTree::Group(tt) => proc_macro::TokenTree::Group(tt.inner.unwrap_nightly()),
165165
TokenTree::Punct(tt) => {
166166
let spacing = match tt.spacing() {
167167
Spacing::Joint => proc_macro::Spacing::Joint,
168168
Spacing::Alone => proc_macro::Spacing::Alone,
169169
};
170170
let mut punct = proc_macro::Punct::new(tt.as_char(), spacing);
171171
punct.set_span(tt.span().inner.unwrap_nightly());
172-
proc_macro::TokenTree::from(punct)
172+
proc_macro::TokenTree::Punct(punct)
173173
}
174-
TokenTree::Ident(tt) => proc_macro::TokenTree::from(tt.inner.unwrap_nightly()),
175-
TokenTree::Literal(tt) => proc_macro::TokenTree::from(tt.inner.unwrap_nightly()),
174+
TokenTree::Ident(tt) => proc_macro::TokenTree::Ident(tt.inner.unwrap_nightly()),
175+
TokenTree::Literal(tt) => proc_macro::TokenTree::Literal(tt.inner.unwrap_nightly()),
176176
}
177177
}
178178

@@ -339,7 +339,7 @@ impl Iterator for TokenTreeIter {
339339
};
340340
Some(match token {
341341
proc_macro::TokenTree::Group(tt) => {
342-
TokenTree::from(crate::Group::_new(Group::Compiler(tt)))
342+
TokenTree::Group(crate::Group::_new(Group::Compiler(tt)))
343343
}
344344
proc_macro::TokenTree::Punct(tt) => {
345345
let spacing = match tt.spacing() {
@@ -348,13 +348,13 @@ impl Iterator for TokenTreeIter {
348348
};
349349
let mut o = Punct::new(tt.as_char(), spacing);
350350
o.set_span(crate::Span::_new(Span::Compiler(tt.span())));
351-
TokenTree::from(o)
351+
TokenTree::Punct(o)
352352
}
353353
proc_macro::TokenTree::Ident(s) => {
354-
TokenTree::from(crate::Ident::_new(Ident::Compiler(s)))
354+
TokenTree::Ident(crate::Ident::_new(Ident::Compiler(s)))
355355
}
356356
proc_macro::TokenTree::Literal(l) => {
357-
TokenTree::from(crate::Literal::_new(Literal::Compiler(l)))
357+
TokenTree::Literal(crate::Literal::_new(Literal::Compiler(l)))
358358
}
359359
})
360360
}

0 commit comments

Comments
 (0)