@@ -130,15 +130,12 @@ pub async fn create_user_with_meta(
130130pub struct SkipResponse {
131131 pub name : String ,
132132 #[ serde( skip) ]
133- #[ allow( dead_code) ]
134133 pub email : String ,
135134
136135 #[ serde( skip, skip_serializing_if = "Option::is_none" ) ]
137- #[ allow( dead_code) ]
138136 pub email2 : Option < String > ,
139137
140138 #[ serde( rename = "email3" , skip) ]
141- #[ allow( dead_code) ]
142139 pub email3 : Option < String > ,
143140
144141 #[ serde( rename = "email4" , skip_serializing_if = "Option::is_none" ) ]
@@ -151,7 +148,6 @@ pub struct SkipResponse {
151148 pub email6 : String ,
152149
153150 #[ serde( rename = "email7" , skip) ]
154- #[ allow( dead_code) ]
155151 pub email7 : String ,
156152
157153 #[ serde( rename = "num" , default ) ]
@@ -176,7 +172,7 @@ fn default_value() -> String {
176172
177173#[ vespera:: route( get, path = "/skip-response" ) ]
178174pub async fn skip_response ( ) -> Json < SkipResponse > {
179- Json ( SkipResponse {
175+ let response = SkipResponse {
180176 name : "John Doe" . to_string ( ) ,
181177 email : "john.doe@example.com" . to_string ( ) ,
182178 email2 : Some ( "john.doe2@example.com" . to_string ( ) ) ,
@@ -210,5 +206,8 @@ pub async fn skip_response() -> Json<SkipResponse> {
210206 name : "John Doe" . to_string ( ) ,
211207 } ,
212208 ) ] ) ) ,
213- } )
209+ } ;
210+ // Read skip fields to validate they're populated correctly
211+ let _ = ( & response. email , & response. email2 , & response. email3 , & response. email7 ) ;
212+ Json ( response)
214213}
0 commit comments