Remove type-macros cfg

This commit is contained in:
David Tolnay 2017-01-23 17:59:46 -08:00
parent 9fdf2767ce
commit 3f36a0a5d6
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 2 additions and 35 deletions

View File

@ -11,10 +11,9 @@ include = ["Cargo.toml", "src/**/*.rs"]
[features]
default = ["parsing", "printing"]
aster = []
full = ["type-macros"]
full = []
parsing = ["unicode-xid"]
printing = ["quote"]
type-macros = []
visit = []
[dependencies]

View File

@ -61,9 +61,7 @@ pub use krate::Crate;
mod lit;
pub use lit::{FloatTy, IntTy, Lit, StrStyle};
#[cfg(feature = "type-macros")]
mod mac;
#[cfg(feature = "type-macros")]
pub use mac::{BinOpToken, DelimToken, Delimited, Mac, Token, TokenTree};
mod derive;

View File

@ -37,12 +37,6 @@ pub enum Ty {
Mac(Mac),
}
#[cfg(not(feature = "type-macros"))]
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Mac {
_private: (),
}
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct MutTy {
pub ty: Ty,
@ -246,10 +240,7 @@ pub mod parsing {
use generics::parsing::{lifetime, lifetime_def, ty_param_bound, bound_lifetimes};
use ident::parsing::ident;
use lit::parsing::quoted_string;
#[cfg(feature = "type-macros")]
use mac::parsing::mac;
#[cfg(not(feature = "type-macros"))]
use nom::IResult;
use std::str;
named!(pub ty -> Ty, alt!(
@ -278,14 +269,8 @@ pub mod parsing {
ty_impl_trait
));
#[cfg(feature = "type-macros")]
named!(ty_mac -> Ty, map!(mac, Ty::Mac));
#[cfg(not(feature = "type-macros"))]
fn ty_mac(_: &str) -> IResult<&str, Ty> {
IResult::Error
}
named!(ty_vec -> Ty, do_parse!(
punct!("[") >>
elem: ty >>
@ -856,11 +841,4 @@ mod printing {
}
}
}
#[cfg(not(feature = "type-macros"))]
impl ToTokens for Mac {
fn to_tokens(&self, _tokens: &mut Tokens) {
unreachable!()
}
}
}

View File

@ -77,7 +77,6 @@ pub trait Visitor: Sized {
}
fn visit_lit(&mut self, _lit: &Lit) {}
#[cfg(feature = "type-macros")]
fn visit_mac(&mut self, mac: &Mac) {
walk_mac(self, mac);
}
@ -216,13 +215,7 @@ pub fn walk_ty<V: Visitor>(visitor: &mut V, ty: &Ty) {
walk_list!(visitor, visit_ty_param_bound, bounds);
}
Ty::Mac(ref mac) => {
#[cfg(feature = "type-macros")]
fn walk_tymac<V: Visitor>(visitor: &mut V, mac: &Mac) {
visitor.visit_mac(mac);
}
#[cfg(not(feature = "type-macros"))]
fn walk_tymac<V: Visitor>(_: &mut V, _: &super::ty::Mac) {}
walk_tymac(visitor, mac);
visitor.visit_mac(mac);
}
}
}
@ -361,7 +354,6 @@ pub fn walk_const_expr<V: Visitor>(visitor: &mut V, len: &ConstExpr) {
}
}
#[cfg(feature = "type-macros")]
pub fn walk_mac<V: Visitor>(visitor: &mut V, mac: &Mac) {
visitor.visit_path(&mac.path);
}