@@ -83,7 +83,9 @@ map!(Metadata, map, {
8383 "target_directory" => target_directory = Some ( map. next_value( ) ?) ,
8484 "metadata" => workspace_metadata = map. next_value( ) ?,
8585 "version" => version = map. next_value( ) ?,
86- _ => { }
86+ _ => {
87+ map. next_value:: <Ignore >( ) ?;
88+ }
8789 }
8890 }
8991
@@ -107,7 +109,9 @@ map!(Resolve, map, {
107109 match key. as_ref( ) {
108110 "nodes" => nodes = Some ( map. next_value( ) ?) ,
109111 "root" => root = Some ( map. next_value( ) ?) ,
110- _ => { }
112+ _ => {
113+ map. next_value:: <Ignore >( ) ?;
114+ }
111115 }
112116 }
113117
@@ -129,7 +133,9 @@ map!(Node, map, {
129133 "deps" => deps = map. next_value( ) ?,
130134 "dependencies" => dependencies = Some ( map. next_value( ) ?) ,
131135 "features" => features = map. next_value( ) ?,
132- _ => { }
136+ _ => {
137+ map. next_value:: <Ignore >( ) ?;
138+ }
133139 }
134140 }
135141
@@ -151,7 +157,9 @@ map!(NodeDep, map, {
151157 "name" => name = Some ( map. next_value( ) ?) ,
152158 "pkg" => pkg = Some ( map. next_value( ) ?) ,
153159 "dep_kinds" => dep_kinds = map. next_value( ) ?,
154- _ => { }
160+ _ => {
161+ map. next_value:: <Ignore >( ) ?;
162+ }
155163 }
156164 }
157165
@@ -170,7 +178,9 @@ map!(DepKindInfo, map, {
170178 match key. as_ref( ) {
171179 "kind" => kind = map. next_value( ) ?,
172180 "target" => target = map. next_value( ) ?,
173- _ => { }
181+ _ => {
182+ map. next_value:: <Ignore >( ) ?;
183+ }
174184 }
175185 }
176186
@@ -224,7 +234,9 @@ map!(Dependency, map, {
224234 "rename" => rename = map. next_value( ) ?,
225235 "registry" => registry = map. next_value( ) ?,
226236 "path" => path = map. next_value( ) ?,
227- _ => { }
237+ _ => {
238+ map. next_value:: <Ignore >( ) ?;
239+ }
228240 }
229241 }
230242
@@ -304,7 +316,9 @@ map!(Package, map, {
304316 rust_version = Some ( deserialize_rust_version( s) ?) ;
305317 }
306318 }
307- _ => { }
319+ _ => {
320+ map. next_value:: <Ignore >( ) ?;
321+ }
308322 }
309323 }
310324
@@ -358,7 +372,9 @@ map!(Target, map, {
358372 "doctest" => doctest = map. next_value( ) ?,
359373 "test" => test = map. next_value( ) ?,
360374 "doc" => doc = map. next_value( ) ?,
361- _ => { }
375+ _ => {
376+ map. next_value:: <Ignore >( ) ?;
377+ }
362378 }
363379 }
364380
@@ -412,3 +428,121 @@ fn deserialize_rust_version<E: Error>(mut buf: String) -> Result<semver::Version
412428
413429 Version :: parse ( & buf) . map_err ( E :: custom)
414430}
431+
432+ pub struct Ignore ;
433+
434+ impl < ' de > Visitor < ' de > for Ignore {
435+ type Value = Self ;
436+
437+ fn expecting ( & self , _formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
438+ Ok ( ( ) )
439+ }
440+
441+ #[ inline]
442+ fn visit_bool < E > ( self , _x : bool ) -> Result < Self :: Value , E > {
443+ Ok ( Self )
444+ }
445+
446+ #[ inline]
447+ fn visit_i64 < E > ( self , _x : i64 ) -> Result < Self :: Value , E > {
448+ Ok ( Self )
449+ }
450+
451+ #[ inline]
452+ fn visit_i128 < E > ( self , _x : i128 ) -> Result < Self :: Value , E > {
453+ Ok ( Self )
454+ }
455+
456+ #[ inline]
457+ fn visit_u64 < E > ( self , _x : u64 ) -> Result < Self :: Value , E > {
458+ Ok ( Self )
459+ }
460+
461+ #[ inline]
462+ fn visit_u128 < E > ( self , _x : u128 ) -> Result < Self :: Value , E > {
463+ Ok ( Self )
464+ }
465+
466+ #[ inline]
467+ fn visit_f64 < E > ( self , _x : f64 ) -> Result < Self :: Value , E > {
468+ Ok ( Self )
469+ }
470+
471+ #[ inline]
472+ fn visit_str < E > ( self , _s : & str ) -> Result < Self :: Value , E >
473+ where
474+ E : Error ,
475+ {
476+ Ok ( Self )
477+ }
478+
479+ #[ inline]
480+ fn visit_none < E > ( self ) -> Result < Self :: Value , E > {
481+ Ok ( Self )
482+ }
483+
484+ #[ inline]
485+ fn visit_some < D > ( self , deserializer : D ) -> Result < Self :: Value , D :: Error >
486+ where
487+ D : Deserializer < ' de > ,
488+ {
489+ Self :: deserialize ( deserializer)
490+ }
491+
492+ #[ inline]
493+ fn visit_newtype_struct < D > ( self , deserializer : D ) -> Result < Self :: Value , D :: Error >
494+ where
495+ D : Deserializer < ' de > ,
496+ {
497+ Self :: deserialize ( deserializer)
498+ }
499+
500+ #[ inline]
501+ fn visit_unit < E > ( self ) -> Result < Self :: Value , E > {
502+ Ok ( Self )
503+ }
504+
505+ #[ inline]
506+ fn visit_seq < A > ( self , mut seq : A ) -> Result < Self :: Value , A :: Error >
507+ where
508+ A : serde:: de:: SeqAccess < ' de > ,
509+ {
510+ while let Some ( Self ) = seq. next_element ( ) ? { }
511+ Ok ( Self )
512+ }
513+
514+ #[ inline]
515+ fn visit_map < A > ( self , mut map : A ) -> Result < Self :: Value , A :: Error >
516+ where
517+ A : serde:: de:: MapAccess < ' de > ,
518+ {
519+ while let Some ( ( Self , Self ) ) = map. next_entry ( ) ? { }
520+ Ok ( Self )
521+ }
522+
523+ #[ inline]
524+ fn visit_bytes < E > ( self , _bytes : & [ u8 ] ) -> Result < Self :: Value , E >
525+ where
526+ E : Error ,
527+ {
528+ Ok ( Self )
529+ }
530+
531+ fn visit_enum < A > ( self , data : A ) -> Result < Self :: Value , A :: Error >
532+ where
533+ A : serde:: de:: EnumAccess < ' de > ,
534+ {
535+ use serde:: de:: VariantAccess ;
536+ data. variant :: < Self > ( ) ?. 1 . newtype_variant ( )
537+ }
538+ }
539+
540+ impl < ' de > Deserialize < ' de > for Ignore {
541+ #[ inline]
542+ fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
543+ where
544+ D : Deserializer < ' de > ,
545+ {
546+ deserializer. deserialize_ignored_any ( Self )
547+ }
548+ }
0 commit comments