1
Fork 0

Simplify use of keyword symbols

This commit is contained in:
Vadim Petrochenkov 2019-05-11 17:41:37 +03:00
parent 37ff5d388f
commit 59a382122f
58 changed files with 502 additions and 534 deletions

View file

@ -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`"),