- Notifications
You must be signed in to change notification settings - Fork 610
Open
Labels
Description
Currently an invocation like json!({ "x": 0, "y": 'y' as i8, "z": [] })
expands into:
::serde_json::Value::Object({ let mut object = ::serde_json::Map::new(); let _ = object.insert(...); let _ = object.insert(...); let _ = object.insert(...); object })
It would be better if it were able to allocate capacity up front, such as by:
- let mut object = ::serde_json::Map::new(); + let mut object = ::serde_json::Map::with_capacity(1 + 1 + 1);