Skip to content

Commit 8a14cec

Browse files
committed
Use unwrap_err
Tidy this test up a bit by using `unwrap_err`
1 parent 79bc492 commit 8a14cec

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/async.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,26 +235,24 @@ fn error_response() {
235235
)
236236
.test(|mut db| async move {
237237
let res: Result<Vec<mysql_async::Row>, _> = db.query("SELECT a, b FROM foo").await;
238-
239-
match res {
240-
Ok(_) => assert!(false),
241-
Err(mysql_async::Error::Server(mysql_async::ServerError {
238+
match res.unwrap_err() {
239+
mysql_async::Error::Server(mysql_async::ServerError {
242240
code,
243241
message: ref msg,
244242
ref state,
245-
})) => {
243+
}) => {
246244
assert_eq!(
247245
state,
248246
&String::from_utf8(err.0.sqlstate().to_vec()).unwrap()
249247
);
250248
assert_eq!(code, err.0 as u16);
251249
assert_eq!(msg, &err.1);
252250
}
253-
Err(e) => {
251+
e => {
254252
eprintln!("unexpected {:?}", e);
255253
assert!(false);
256254
}
257-
}
255+
};
258256
Ok(())
259257
})
260258
}

0 commit comments

Comments
 (0)