Simplify code

This commit is contained in:
Esteban Küber
2019-03-04 12:59:43 -08:00
parent 3818f8ba34
commit 6f0f2fc6d6
4 changed files with 16 additions and 29 deletions

View File

@@ -12,7 +12,6 @@ use syntax::ast;
use syntax::ext::base::ExtCtxt;
use syntax::parse::lexer::comments;
use syntax::parse::{self, token, ParseSess};
use syntax::parse::parser::emit_unclosed_delims;
use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint};
use syntax_pos::hygiene::{SyntaxContext, Transparency};
use syntax_pos::symbol::{keywords, Symbol};
@@ -410,14 +409,12 @@ impl server::TokenStream for Rustc<'_> {
stream.is_empty()
}
fn from_str(&mut self, src: &str) -> Self::TokenStream {
let (tokens, mut errors) = parse::parse_stream_from_source_str(
parse::parse_stream_from_source_str(
FileName::proc_macro_source_code(src.clone()),
src.to_string(),
self.sess,
Some(self.call_site),
);
emit_unclosed_delims(&mut errors, &self.sess.span_diagnostic);
tokens
)
}
fn to_string(&mut self, stream: &Self::TokenStream) -> String {
stream.to_string()