mirror of
				https://github.com/serde-rs/json.git
				synced 2025-11-03 23:12:59 +00:00 
			
		
		
		
	Omit a layer of unnecessary nesting from Debug impl
This commit is contained in:
		
							parent
							
								
									baae6d9306
								
							
						
					
					
						commit
						351d847e17
					
				@ -177,8 +177,16 @@ impl Debug for Value {
 | 
			
		||||
            Value::Bool(v) => formatter.debug_tuple("Bool").field(&v).finish(),
 | 
			
		||||
            Value::Number(ref v) => Debug::fmt(v, formatter),
 | 
			
		||||
            Value::String(ref v) => formatter.debug_tuple("String").field(v).finish(),
 | 
			
		||||
            Value::Array(ref v) => formatter.debug_tuple("Array").field(v).finish(),
 | 
			
		||||
            Value::Object(ref v) => formatter.debug_tuple("Object").field(v).finish(),
 | 
			
		||||
            Value::Array(ref v) => {
 | 
			
		||||
                formatter.write_str("Array(")?;
 | 
			
		||||
                Debug::fmt(v, formatter)?;
 | 
			
		||||
                formatter.write_str(")")
 | 
			
		||||
            }
 | 
			
		||||
            Value::Object(ref v) => {
 | 
			
		||||
                formatter.write_str("Object(")?;
 | 
			
		||||
                Debug::fmt(v, formatter)?;
 | 
			
		||||
                formatter.write_str(")")
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -50,20 +50,16 @@ fn error() {
 | 
			
		||||
    assert_eq!(format!("{:?}", err), expected);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const INDENTED_EXPECTED: &str = r#"Object(
 | 
			
		||||
    {
 | 
			
		||||
        "array": Array(
 | 
			
		||||
            [
 | 
			
		||||
const INDENTED_EXPECTED: &str = r#"Object({
 | 
			
		||||
    "array": Array([
 | 
			
		||||
        Number(
 | 
			
		||||
            0,
 | 
			
		||||
        ),
 | 
			
		||||
        Number(
 | 
			
		||||
            1,
 | 
			
		||||
        ),
 | 
			
		||||
            ],
 | 
			
		||||
        ),
 | 
			
		||||
    },
 | 
			
		||||
)"#;
 | 
			
		||||
    ]),
 | 
			
		||||
})"#;
 | 
			
		||||
 | 
			
		||||
#[test]
 | 
			
		||||
fn indented() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user