Remove Span wrapper type

This commit is contained in:
David Tolnay 2020-03-15 23:27:11 -07:00
parent c21b20ac0f
commit d0bb3646cf
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 4 additions and 22 deletions

View File

@ -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 {

View File

@ -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));
}
_ => {}
}

View File

@ -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
}
}

View File

@ -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=> ())),
}
}
}