mirror of
https://github.com/async-rs/async-std.git
synced 2025-01-16 10:49:55 +00:00
Verbose errors: Apply suggestions
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
This commit is contained in:
parent
e01f07d72a
commit
aa7d1c27a4
3 changed files with 7 additions and 7 deletions
|
@ -114,7 +114,7 @@ impl File {
|
|||
pub async fn open<P: AsRef<Path>>(path: P) -> io::Result<File> {
|
||||
let path = path.as_ref().to_owned();
|
||||
let file = spawn_blocking(move || {
|
||||
std::fs::File::open(&path).context(|| format!("Could not open `{}`", path.display()))
|
||||
std::fs::File::open(&path).context(|| format!("could not open `{}`", path.display()))
|
||||
})
|
||||
.await?;
|
||||
Ok(File::new(file, true))
|
||||
|
@ -153,7 +153,7 @@ impl File {
|
|||
let path = path.as_ref().to_owned();
|
||||
let file = spawn_blocking(move || {
|
||||
std::fs::File::create(&path)
|
||||
.context(|| format!("Could not create `{}`", path.display()))
|
||||
.context(|| format!("could not create `{}`", path.display()))
|
||||
})
|
||||
.await?;
|
||||
Ok(File::new(file, true))
|
||||
|
|
|
@ -163,7 +163,7 @@ impl Stdin {
|
|||
}
|
||||
})
|
||||
.await
|
||||
.context(|| String::from("Could not read line on stdin"))
|
||||
.context(|| String::from("could not read line on stdin"))
|
||||
}
|
||||
|
||||
/// Locks this handle to the standard input stream, returning a readable guard.
|
||||
|
|
|
@ -159,7 +159,7 @@ impl UdpSocket {
|
|||
.poll_write_with(cx, |inner| inner.send_to(buf, &addr))
|
||||
})
|
||||
.await
|
||||
.context(|| format!("Could not send packet to {}", addr))
|
||||
.context(|| format!("could not send packet to {}", addr))
|
||||
}
|
||||
|
||||
/// Receives data from the socket.
|
||||
|
@ -190,7 +190,7 @@ impl UdpSocket {
|
|||
.context(|| {
|
||||
use std::fmt::Write;
|
||||
|
||||
let mut error = String::from("Could not receive data on ");
|
||||
let mut error = String::from("could not receive data on ");
|
||||
if let Ok(addr) = self.local_addr() {
|
||||
let _ = write!(&mut error, "{}", addr);
|
||||
} else {
|
||||
|
@ -277,7 +277,7 @@ impl UdpSocket {
|
|||
.context(|| {
|
||||
use std::fmt::Write;
|
||||
|
||||
let mut error = String::from("Could not send data on ");
|
||||
let mut error = String::from("could not send data on ");
|
||||
if let Ok(addr) = self.local_addr() {
|
||||
let _ = write!(&mut error, "{}", addr);
|
||||
} else {
|
||||
|
@ -312,7 +312,7 @@ impl UdpSocket {
|
|||
.context(|| {
|
||||
use std::fmt::Write;
|
||||
|
||||
let mut error = String::from("Could not receive data on ");
|
||||
let mut error = String::from("could not receive data on ");
|
||||
if let Ok(addr) = self.local_addr() {
|
||||
let _ = write!(&mut error, "{}", addr);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue