summaryrefslogtreecommitdiffstats
path: root/vendor/serde_derive/src/dummy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/serde_derive/src/dummy.rs')
-rw-r--r--vendor/serde_derive/src/dummy.rs22
1 files changed, 3 insertions, 19 deletions
diff --git a/vendor/serde_derive/src/dummy.rs b/vendor/serde_derive/src/dummy.rs
index 2be502713..57e8eabf2 100644
--- a/vendor/serde_derive/src/dummy.rs
+++ b/vendor/serde_derive/src/dummy.rs
@@ -1,23 +1,11 @@
-use proc_macro2::{Ident, TokenStream};
-use quote::format_ident;
+use proc_macro2::TokenStream;
use syn;
use try;
-pub fn wrap_in_const(
- serde_path: Option<&syn::Path>,
- trait_: &str,
- ty: &Ident,
- code: TokenStream,
-) -> TokenStream {
+pub fn wrap_in_const(serde_path: Option<&syn::Path>, code: TokenStream) -> TokenStream {
let try_replacement = try::replacement();
- let dummy_const = if cfg!(no_underscore_consts) {
- format_ident!("_IMPL_{}_FOR_{}", trait_, unraw(ty))
- } else {
- format_ident!("_")
- };
-
let use_serde = match serde_path {
Some(path) => quote! {
use #path as _serde;
@@ -31,14 +19,10 @@ pub fn wrap_in_const(
quote! {
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
- const #dummy_const: () = {
+ const _: () = {
#use_serde
#try_replacement
#code
};
}
}
-
-fn unraw(ident: &Ident) -> String {
- ident.to_string().trim_start_matches("r#").to_owned()
-}