diff --git a/contrib/src/json.rs b/contrib/src/json.rs index 38b2f64d..2164f12d 100644 --- a/contrib/src/json.rs +++ b/contrib/src/json.rs @@ -21,7 +21,7 @@ pub use serde_json::error::Error as SerdeError; fn from_reader_eager(mut reader: R) -> serde_json::Result where R: Read, T: DeserializeOwned { - let mut s = String::new(); + let mut s = String::with_capacity(512); if let Err(io_err) = reader.read_to_string(&mut s) { // Error::io is private to serde_json. Do not use outside of Rocket. return Err(SerdeError::io(io_err));