macros: Silence deprecation warnings in generated code
This commit is contained in:
		
							parent
							
								
									cdc6b9a2aa
								
							
						
					
					
						commit
						e86ee7dd31
					
				| @ -8,6 +8,7 @@ pub fn expand_deserialize_from_cow_str(ident: &Ident) -> syn::Result<TokenStream | |||||||
| 
 | 
 | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl<'de> #ruma_common::exports::serde::de::Deserialize<'de> for #ident { |         impl<'de> #ruma_common::exports::serde::de::Deserialize<'de> for #ident { | ||||||
|             fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error> |             fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error> | ||||||
|             where |             where | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ use quote::quote; | |||||||
| pub fn expand_display_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | pub fn expand_display_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl ::std::fmt::Display for #ident { |         impl ::std::fmt::Display for #ident { | ||||||
|             fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { |             fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { | ||||||
|                 f.write_str(::std::convert::AsRef::<::std::primitive::str>::as_ref(self)) |                 f.write_str(::std::convert::AsRef::<::std::primitive::str>::as_ref(self)) | ||||||
|  | |||||||
| @ -50,6 +50,7 @@ pub fn expand_enum_as_ref_str(input: &ItemEnum) -> syn::Result<TokenStream> { | |||||||
| 
 | 
 | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl ::std::convert::AsRef<::std::primitive::str> for #enum_name { |         impl ::std::convert::AsRef<::std::primitive::str> for #enum_name { | ||||||
|             fn as_ref(&self) -> &::std::primitive::str { |             fn as_ref(&self) -> &::std::primitive::str { | ||||||
|                 match self { #(#branches),* } |                 match self { #(#branches),* } | ||||||
|  | |||||||
| @ -69,6 +69,7 @@ pub fn expand_enum_from_string(input: &ItemEnum) -> syn::Result<TokenStream> { | |||||||
| 
 | 
 | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl<T> ::std::convert::From<T> for #enum_name |         impl<T> ::std::convert::From<T> for #enum_name | ||||||
|         where |         where | ||||||
|             T: ::std::convert::AsRef<::std::primitive::str> |             T: ::std::convert::AsRef<::std::primitive::str> | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ use quote::quote; | |||||||
| pub fn expand_partial_eq_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | pub fn expand_partial_eq_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl ::std::cmp::PartialEq for #ident { |         impl ::std::cmp::PartialEq for #ident { | ||||||
|             fn eq(&self, other: &Self) -> bool { |             fn eq(&self, other: &Self) -> bool { | ||||||
|                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); |                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ use quote::quote; | |||||||
| pub fn expand_partial_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | pub fn expand_partial_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl ::std::cmp::PartialOrd for #ident { |         impl ::std::cmp::PartialOrd for #ident { | ||||||
|             fn partial_cmp(&self, other: &Self) -> ::std::option::Option<::std::cmp::Ordering> { |             fn partial_cmp(&self, other: &Self) -> ::std::option::Option<::std::cmp::Ordering> { | ||||||
|                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); |                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); | ||||||
| @ -16,6 +17,7 @@ pub fn expand_partial_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> | |||||||
| pub fn expand_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | pub fn expand_ord_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl ::std::cmp::Ord for #ident { |         impl ::std::cmp::Ord for #ident { | ||||||
|             fn cmp(&self, other: &Self) -> ::std::cmp::Ordering { |             fn cmp(&self, other: &Self) -> ::std::cmp::Ordering { | ||||||
|                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); |                 let other = ::std::convert::AsRef::<::std::primitive::str>::as_ref(other); | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ pub fn expand_serialize_as_ref_str(ident: &Ident) -> syn::Result<TokenStream> { | |||||||
| 
 | 
 | ||||||
|     Ok(quote! { |     Ok(quote! { | ||||||
|         #[automatically_derived] |         #[automatically_derived] | ||||||
|  |         #[allow(deprecated)] | ||||||
|         impl #ruma_common::exports::serde::ser::Serialize for #ident { |         impl #ruma_common::exports::serde::ser::Serialize for #ident { | ||||||
|             fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error> |             fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error> | ||||||
|             where |             where | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user