mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-28 01:41:05 +00:00
Remove Span wrapper type
This commit is contained in:
parent
c21b20ac0f
commit
d0bb3646cf
@ -9,17 +9,15 @@ pub mod ident;
|
||||
mod impls;
|
||||
mod parse;
|
||||
pub mod set;
|
||||
mod span;
|
||||
mod tokens;
|
||||
pub mod types;
|
||||
|
||||
use proc_macro2::Ident;
|
||||
use proc_macro2::{Ident, Span};
|
||||
use syn::{LitStr, Token};
|
||||
|
||||
pub use self::atom::Atom;
|
||||
pub use self::doc::Doc;
|
||||
pub use self::parse::parse_items;
|
||||
pub use self::span::Span;
|
||||
pub use self::types::Types;
|
||||
|
||||
pub enum Api {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::syntax::{
|
||||
self, attrs, error, Api, Atom, Doc, ExternFn, ExternType, Receiver, Ref, Struct, Ty1, Type, Var,
|
||||
attrs, error, Api, Atom, Doc, ExternFn, ExternType, Receiver, Ref, Struct, Ty1, Type, Var,
|
||||
};
|
||||
use proc_macro2::Ident;
|
||||
use quote::quote;
|
||||
@ -252,7 +252,7 @@ fn parse_type(ty: &RustType) -> Result<Type> {
|
||||
}
|
||||
}
|
||||
RustType::Tuple(ty) if ty.elems.is_empty() => {
|
||||
return Ok(Type::Void(syntax::Span(ty.paren_token.span)));
|
||||
return Ok(Type::Void(ty.paren_token.span));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Span(pub proc_macro2::Span);
|
||||
|
||||
impl Hash for Span {
|
||||
fn hash<H: Hasher>(&self, _state: &mut H) {}
|
||||
}
|
||||
|
||||
impl Eq for Span {}
|
||||
|
||||
impl PartialEq for Span {
|
||||
fn eq(&self, _other: &Span) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ impl ToTokens for Type {
|
||||
}
|
||||
Type::RustBox(ty) | Type::UniquePtr(ty) => ty.to_tokens(tokens),
|
||||
Type::Ref(r) | Type::Str(r) => r.to_tokens(tokens),
|
||||
Type::Void(span) => tokens.extend(quote_spanned!(span.0=> ())),
|
||||
Type::Void(span) => tokens.extend(quote_spanned!(*span=> ())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user