Simplify use of keyword symbols
This commit is contained in:
parent
37ff5d388f
commit
59a382122f
58 changed files with 502 additions and 534 deletions
|
@ -1,6 +1,6 @@
|
|||
use syntax::ext::base::{self, ExtCtxt};
|
||||
use syntax::feature_gate;
|
||||
use syntax::symbol::{keywords, sym};
|
||||
use syntax::symbol::{kw, sym};
|
||||
use syntax_pos::Span;
|
||||
use syntax::tokenstream::TokenTree;
|
||||
|
||||
|
@ -17,10 +17,10 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt<'_>,
|
|||
}
|
||||
|
||||
match (tt.len(), tt.first()) {
|
||||
(1, Some(&TokenTree::Token(_, ref tok))) if tok.is_keyword(keywords::True) => {
|
||||
(1, Some(&TokenTree::Token(_, ref tok))) if tok.is_keyword(kw::True) => {
|
||||
cx.set_trace_macros(true);
|
||||
}
|
||||
(1, Some(&TokenTree::Token(_, ref tok))) if tok.is_keyword(keywords::False) => {
|
||||
(1, Some(&TokenTree::Token(_, ref tok))) if tok.is_keyword(kw::False) => {
|
||||
cx.set_trace_macros(false);
|
||||
}
|
||||
_ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue