diff options
Diffstat (limited to 'gfx/wr/peek-poke/peek-poke-derive/src')
-rw-r--r-- | gfx/wr/peek-poke/peek-poke-derive/src/lib.rs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/gfx/wr/peek-poke/peek-poke-derive/src/lib.rs b/gfx/wr/peek-poke/peek-poke-derive/src/lib.rs index ac20b2b922..9e26b22fba 100644 --- a/gfx/wr/peek-poke/peek-poke-derive/src/lib.rs +++ b/gfx/wr/peek-poke/peek-poke-derive/src/lib.rs @@ -12,23 +12,6 @@ use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{Ident, Index, TraitBound}; use synstructure::{decl_derive, Structure, BindStyle, AddBounds}; -use unicode_xid::UnicodeXID; - -// Internal method for sanitizing an identifier for hygiene purposes. -fn sanitize_ident(s: &str) -> Ident { - let mut res = String::with_capacity(s.len()); - for mut c in s.chars() { - if !UnicodeXID::is_xid_continue(c) { - c = '_' - } - // Deduplicate consecutive _ characters. - if res.ends_with('_') && c == '_' { - continue; - } - res.push(c); - } - Ident::new(&res, Span::call_site()) -} /// Calculates size type for number of variants (used for enums) fn get_discriminant_size_type(len: usize) -> TokenStream { @@ -241,11 +224,9 @@ fn peek_poke_derive(mut s: Structure) -> TokenStream { s.add_trait_bounds(&default_trait, &mut where_clause, AddBounds::Generics); s.add_trait_bounds(&peek_trait, &mut where_clause, AddBounds::Generics); - let dummy_const: Ident = sanitize_ident(&format!("_DERIVE_peek_poke_Peek_FOR_{}", name)); - let peek_impl = quote! { #[allow(non_upper_case_globals)] - const #dummy_const: () = { + const _: () = { extern crate peek_poke; impl #impl_generics peek_poke::Peek for #name #ty_generics #where_clause { |