mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2025-02-17 05:57:30 +00:00
Remove type-macros cfg
This commit is contained in:
parent
9fdf2767ce
commit
3f36a0a5d6
@ -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]
|
||||
|
@ -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;
|
||||
|
22
src/ty.rs
22
src/ty.rs
@ -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!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
src/visit.rs
10
src/visit.rs
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user