Some final rustfmt changes.
This commit is contained in:
@@ -49,13 +49,10 @@ impl Body {
|
||||
pub fn read_to_string(mut body: Body) -> ::std::io::Result<String> {
|
||||
let mut s = String::new();
|
||||
match body.reader {
|
||||
Kind::Reader(ref mut reader, _) => {
|
||||
reader.read_to_string(&mut s)
|
||||
Kind::Reader(ref mut reader, _) => reader.read_to_string(&mut s),
|
||||
Kind::Bytes(ref mut bytes) => (&**bytes).read_to_string(&mut s),
|
||||
}
|
||||
Kind::Bytes(ref mut bytes) => {
|
||||
(&**bytes).read_to_string(&mut s)
|
||||
}
|
||||
}.map(|_| s)
|
||||
.map(|_| s)
|
||||
}
|
||||
|
||||
enum Kind {
|
||||
|
||||
@@ -20,8 +20,8 @@ static DEFAULT_USER_AGENT: &'static str =
|
||||
pub fn spawn(txns: Vec<(Vec<u8>, Vec<u8>)>) -> Server {
|
||||
let listener = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let addr = listener.local_addr().unwrap();
|
||||
thread::spawn(move || {
|
||||
for (mut expected, reply) in txns {
|
||||
thread::spawn(
|
||||
move || for (mut expected, reply) in txns {
|
||||
let (mut socket, _addr) = listener.accept().unwrap();
|
||||
replace_expected_vars(&mut expected, addr.to_string().as_ref(), DEFAULT_USER_AGENT.as_ref());
|
||||
let mut buf = [0; 4096];
|
||||
@@ -33,7 +33,7 @@ pub fn spawn(txns: Vec<(Vec<u8>, Vec<u8>)>) -> Server {
|
||||
}
|
||||
socket.write_all(&reply).unwrap();
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
Server {
|
||||
addr: addr,
|
||||
|
||||
Reference in New Issue
Block a user