don't create intermediate string while creating json (rustdoc)
auto merge of #10721 : osa1/rust/intermediatestr, r=brson

as recommended by @huonw on this PR https://github.com/mozilla/rust/pull/10711 , I removed intermediate step that generates a string instead of directly writing to Writer without generating intermediate string.