Fix compilation errors on latest nightly

staging
Stjepan Glavina 5 years ago
parent 06f2569d23
commit ab1e2b403a

@ -115,7 +115,8 @@ async fn broker(mut events: Receiver<Event>) -> Result<()> {
Event::Message { from, to, msg } => {
for addr in to {
if let Some(peer) = peers.get_mut(&addr) {
peer.send(format!("from {}: {}\n", from, msg)).await?
let msg = format!("from {}: {}\n", from, msg);
peer.send(msg).await?
}
}
}

@ -115,7 +115,8 @@ Let's add waiting to the server:
# Event::Message { from, to, msg } => {
# for addr in to {
# if let Some(peer) = peers.get_mut(&addr) {
# peer.send(format!("from {}: {}\n", from, msg)).await?
# let msg = format!("from {}: {}\n", from, msg);
# peer.send(msg).await?
# }
# }
# }
@ -217,7 +218,8 @@ async fn broker(mut events: Receiver<Event>) -> Result<()> {
Event::Message { from, to, msg } => {
for addr in to {
if let Some(peer) = peers.get_mut(&addr) {
peer.send(format!("from {}: {}\n", from, msg)).await?
let msg = format!("from {}: {}\n", from, msg);
peer.send(msg).await?
}
}
}

@ -73,7 +73,8 @@ async fn broker(mut events: Receiver<Event>) -> Result<()> {
Event::Message { from, to, msg } => { // 3
for addr in to {
if let Some(peer) = peers.get_mut(&addr) {
peer.send(format!("from {}: {}\n", from, msg)).await?
let msg = format!("from {}: {}\n", from, msg);
peer.send(msg).await?
}
}
}

@ -257,7 +257,8 @@ async fn broker(events: Receiver<Event>) {
Event::Message { from, to, msg } => {
for addr in to {
if let Some(peer) = peers.get_mut(&addr) {
peer.send(format!("from {}: {}\n", from, msg)).await
let msg = format!("from {}: {}\n", from, msg);
peer.send(fmt).await
.unwrap() // 6
}
}

@ -139,9 +139,8 @@ async fn broker_loop(mut events: Receiver<Event>) {
Event::Message { from, to, msg } => {
for addr in to {
if let Some(peer) = peers.get_mut(&addr) {
peer.send(format!("from {}: {}\n", from, msg))
.await
.unwrap()
let msg = format!("from {}: {}\n", from, msg);
peer.send(msg).await.unwrap();
}
}
}

@ -10,7 +10,7 @@ async fn get() -> io::Result<Vec<u8>> {
let mut buf = vec![];
io::timeout(Duration::from_secs(5), async {
io::timeout(Duration::from_secs(5), async move {
stream.read_to_end(&mut buf).await?;
Ok(buf)
})

Loading…
Cancel
Save