Skip to content

Commit f690158

Browse files
committed
Replace std::io::Error::new(ErrorKind::Other, ...) with std::io::Error::other
1 parent b6fc80d commit f690158

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/builder/create_attachment.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@ impl CreateAttachment {
4949
let mut data = Vec::new();
5050
file.read_to_end(&mut data).await?;
5151

52-
let filename = path.as_ref().file_name().ok_or_else(|| {
53-
std::io::Error::new(
54-
std::io::ErrorKind::Other,
55-
"attachment path must not be a directory",
56-
)
57-
})?;
52+
let filename = path
53+
.as_ref()
54+
.file_name()
55+
.ok_or_else(|| std::io::Error::other("attachment path must not be a directory"))?;
5856

5957
Ok(CreateAttachment::bytes(data, filename.to_string_lossy().to_string()))
6058
}

0 commit comments

Comments
 (0)