mirror of
				https://github.com/serde-rs/serde.git
				synced 2025-11-04 07:24:31 +00:00 
			
		
		
		
	Allow untagged unit variants to deserialize from Visitor::visit_none()
				
					
				
			This commit is contained in:
		
							parent
							
								
									4eb580790d
								
							
						
					
					
						commit
						6e2c385fa5
					
				@ -2510,6 +2510,13 @@ mod content {
 | 
			
		||||
        {
 | 
			
		||||
            Ok(())
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        fn visit_none<E>(self) -> Result<(), E>
 | 
			
		||||
        where
 | 
			
		||||
            E: de::Error,
 | 
			
		||||
        {
 | 
			
		||||
            Ok(())
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -137,6 +137,12 @@ enum EnumOther {
 | 
			
		||||
    Other,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(PartialEq, Debug, Deserialize)]
 | 
			
		||||
#[serde(untagged)]
 | 
			
		||||
enum EnumUntaggedUnit {
 | 
			
		||||
    Unit,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(PartialEq, Debug)]
 | 
			
		||||
struct IgnoredAny;
 | 
			
		||||
 | 
			
		||||
@ -788,6 +794,9 @@ declare_tests! {
 | 
			
		||||
            Token::Unit,
 | 
			
		||||
        ],
 | 
			
		||||
    }
 | 
			
		||||
    test_enum_untagged_unit_from_none {
 | 
			
		||||
        UntaggedUnit::Unit => &[Token::None],
 | 
			
		||||
    }
 | 
			
		||||
    test_box {
 | 
			
		||||
        Box::new(0i32) => &[Token::I32(0)],
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user