Stop special-casing zero fields in macro code
This commit is contained in:
		
							parent
							
								
									a59c43321f
								
							
						
					
					
						commit
						9b2602649f
					
				| @ -142,13 +142,6 @@ impl Request { | ||||
|         ); | ||||
|         let struct_attributes = &self.attributes; | ||||
| 
 | ||||
|         let request_def = if self.fields.is_empty() { | ||||
|             quote!(;) | ||||
|         } else { | ||||
|             let fields = self.fields.iter().map(|request_field| request_field.field()); | ||||
|             quote! { { #(#fields),* } } | ||||
|         }; | ||||
| 
 | ||||
|         let request_body_struct = | ||||
|             if let Some(body_field) = self.fields.iter().find(|f| f.is_newtype_body()) { | ||||
|                 let field = Field { ident: None, colon_token: None, ..body_field.field().clone() }; | ||||
| @ -232,6 +225,8 @@ impl Request { | ||||
|         }; | ||||
| 
 | ||||
|         let lifetimes = self.combine_lifetimes(); | ||||
|         let fields = self.fields.iter().map(|request_field| request_field.field()); | ||||
| 
 | ||||
|         let outgoing_request_impl = self.expand_outgoing(metadata, error_ty, &lifetimes, ruma_api); | ||||
|         let incoming_request_impl = self.expand_incoming(metadata, error_ty, ruma_api); | ||||
| 
 | ||||
| @ -241,7 +236,9 @@ impl Request { | ||||
|             #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] | ||||
|             #[incoming_derive(!Deserialize)] | ||||
|             #( #struct_attributes )* | ||||
|             pub struct Request #lifetimes #request_def | ||||
|             pub struct Request #lifetimes { | ||||
|                 #(#fields),* | ||||
|             } | ||||
| 
 | ||||
|             #request_body_struct | ||||
|             #request_query_struct | ||||
|  | ||||
| @ -52,22 +52,11 @@ impl Response { | ||||
|             format!("Data in the response from the `{}` API endpoint.", metadata.name.value()); | ||||
|         let struct_attributes = &self.attributes; | ||||
| 
 | ||||
|         let response_def = if self.fields.is_empty() { | ||||
|             quote!(;) | ||||
|         } else { | ||||
|             let fields = self.fields.iter().map(|response_field| response_field.field()); | ||||
|             quote! { { #(#fields),* } } | ||||
|         }; | ||||
| 
 | ||||
|         let def = if let Some(body_field) = self.fields.iter().find(|f| f.is_newtype_body()) { | ||||
|             let field = Field { ident: None, colon_token: None, ..body_field.field().clone() }; | ||||
| 
 | ||||
|             quote! { (#field); } | ||||
|         } else if self.has_body_fields() { | ||||
|             let fields = self.fields.iter().filter(|f| f.is_body()); | ||||
| 
 | ||||
|             let fields = fields.map(ResponseField::field); | ||||
| 
 | ||||
|             let fields = self.fields.iter().filter(|f| f.is_body()).map(ResponseField::field); | ||||
|             quote! { { #(#fields),* } } | ||||
|         } else { | ||||
|             quote! { {} } | ||||
| @ -91,6 +80,8 @@ impl Response { | ||||
|             quote! { #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] } | ||||
|         }; | ||||
| 
 | ||||
|         let fields = self.fields.iter().map(|response_field| response_field.field()); | ||||
| 
 | ||||
|         let outgoing_response_impl = self.expand_outgoing(ruma_api); | ||||
|         let incoming_response_impl = self.expand_incoming(error_ty, ruma_api); | ||||
| 
 | ||||
| @ -100,7 +91,9 @@ impl Response { | ||||
|             #non_exhaustive_attr | ||||
|             #[incoming_derive(!Deserialize)] | ||||
|             #( #struct_attributes )* | ||||
|             pub struct Response #response_def | ||||
|             pub struct Response { | ||||
|                 #(#fields),* | ||||
|             } | ||||
| 
 | ||||
|             #response_body_struct | ||||
| 
 | ||||
|  | ||||
| @ -92,7 +92,7 @@ impl IncomingRequest { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -33,6 +33,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Create an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -33,6 +33,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -42,6 +42,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -48,6 +48,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -49,6 +49,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -27,7 +27,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -38,6 +38,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -35,6 +35,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -44,6 +44,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -34,6 +34,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -40,7 +40,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -40,6 +40,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,7 +28,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -50,6 +50,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -59,6 +59,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -29,7 +29,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -64,6 +64,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -41,6 +41,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -40,6 +40,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,7 +28,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -40,6 +40,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -40,6 +40,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -40,6 +40,6 @@ impl Request { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -54,6 +54,6 @@ impl Request<'_> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,7 +28,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -35,6 +35,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -50,7 +50,7 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -28,7 +28,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -35,6 +35,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -38,6 +38,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -43,6 +43,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -70,7 +70,7 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -39,6 +39,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -44,6 +44,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -29,7 +29,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -28,7 +28,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -43,7 +43,7 @@ impl Request { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -77,6 +77,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -48,6 +48,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -57,6 +57,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -47,6 +47,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -44,6 +44,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -46,6 +46,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -36,7 +36,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -24,13 +24,13 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -24,13 +24,13 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -48,6 +48,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -43,6 +43,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -30,7 +30,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -50,7 +50,7 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -46,7 +46,7 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -38,7 +38,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -32,7 +32,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -32,7 +32,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -173,23 +173,15 @@ pub fn expand_event_content( | ||||
|         }; | ||||
|         let redaction_struct_fields = kept_redacted_fields.iter().flat_map(|f| &f.ident); | ||||
| 
 | ||||
|         // redacted_fields allows one to declare an empty redacted event without braces,
 | ||||
|         // otherwise `RedactedWhateverEventContent {}` is needed.
 | ||||
|         // The redacted_return is used in `EventContent::redacted` which only returns
 | ||||
|         // zero sized types (unit structs).
 | ||||
|         let (redacted_fields, redacted_return) = if kept_redacted_fields.is_empty() { | ||||
|             (quote! { ; }, quote! { Ok(#redacted_ident {}) }) | ||||
|         // Used in `EventContent::redacted` which only returns zero sized types (unit structs).
 | ||||
|         let redacted_return = if kept_redacted_fields.is_empty() { | ||||
|             quote! { Ok(#redacted_ident {}) } | ||||
|         } else { | ||||
|             ( | ||||
|                 quote! { | ||||
|                     { #( #kept_redacted_fields, )* } | ||||
|                 }, | ||||
|                 quote! { | ||||
|                     Err(#serde::de::Error::custom( | ||||
|                         format!("this redacted event has fields that cannot be constructed") | ||||
|                     )) | ||||
|                 }, | ||||
|             ) | ||||
|             quote! { | ||||
|                 Err(#serde::de::Error::custom( | ||||
|                     format!("this redacted event has fields that cannot be constructed") | ||||
|                 )) | ||||
|             } | ||||
|         }; | ||||
| 
 | ||||
|         let has_deserialize_fields = if kept_redacted_fields.is_empty() { | ||||
| @ -210,7 +202,7 @@ pub fn expand_event_content( | ||||
|                 impl #redacted_ident { | ||||
|                     #[doc = #doc] | ||||
|                     pub fn new() -> Self { | ||||
|                         Self | ||||
|                         Self {} | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -252,7 +244,9 @@ pub fn expand_event_content( | ||||
|             #[doc = #doc] | ||||
|             #[derive(Clone, Debug, #serde::Deserialize, #serde::Serialize)] | ||||
|             #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] | ||||
|             pub struct #redacted_ident #redacted_fields | ||||
|             pub struct #redacted_ident { | ||||
|                 #( #kept_redacted_fields, )* | ||||
|             } | ||||
| 
 | ||||
|             #initializer | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ pub struct DummyToDeviceEventContent; | ||||
| impl DummyToDeviceEventContent { | ||||
|     /// Create a new `DummyToDeviceEventContent`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -26,7 +26,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -45,7 +45,7 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -52,6 +52,6 @@ impl<'a> Request<'a> { | ||||
| impl Response { | ||||
|     /// Creates a new `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -25,7 +25,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -22,13 +22,13 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -33,6 +33,6 @@ impl Request { | ||||
| impl Response { | ||||
|     /// Creates an empty `Response`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -29,7 +29,7 @@ ruma_api! { | ||||
| impl Request { | ||||
|     /// Creates an empty `Request`.
 | ||||
|     pub fn new() -> Self { | ||||
|         Self | ||||
|         Self {} | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user