From 8e462c5944320e804db041b8a11ae264ef141a09 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 12 Jul 2018 10:35:09 +0600 Subject: [PATCH] use write instead format --- src/server/h1writer.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/h1writer.rs b/src/server/h1writer.rs index 724ee3c6..e8f172f4 100644 --- a/src/server/h1writer.rs +++ b/src/server/h1writer.rs @@ -1,9 +1,10 @@ -#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))] +// #![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))] + +use std::io::{self, Write}; +use std::rc::Rc; use bytes::{BufMut, BytesMut}; use futures::{Async, Poll}; -use std::io; -use std::rc::Rc; use tokio_io::AsyncWrite; use super::helpers; @@ -178,9 +179,8 @@ impl Writer for H1Writer { helpers::write_content_length(len, &mut buffer) } ResponseLength::Length64(len) => { - let s = format!("{}", len); buffer.extend_from_slice(b"\r\ncontent-length: "); - buffer.extend_from_slice(s.as_ref()); + write!(buffer.writer(), "{}", len)?; buffer.extend_from_slice(b"\r\n"); } ResponseLength::None => buffer.extend_from_slice(b"\r\n"),