mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-01 23:12:04 +00:00
Merge pull request #213 from nrjais/210
[Refactor] Remove matches dependency and use matches macro from std
This commit is contained in:
commit
8cb056ccc0
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1712,7 +1712,6 @@ dependencies = [
|
||||
"libc",
|
||||
"libsqlite3-sys",
|
||||
"log",
|
||||
"matches",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
|
@ -73,6 +73,3 @@ version = "0.17.1"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = [ "pkg-config", "vcpkg", "bundled" ]
|
||||
|
||||
[dev-dependencies]
|
||||
matches = "0.1.8"
|
||||
|
@ -103,7 +103,6 @@ impl Handshake {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{AuthPlugin, Capabilities, Handshake, Status};
|
||||
use matches::assert_matches;
|
||||
|
||||
const HANDSHAKE_MARIA_DB_10_4_7: &[u8] = b"\n5.5.5-10.4.7-MariaDB-1:10.4.7+maria~bionic\x00\x0b\x00\x00\x00t6L\\j\"dS\x00\xfe\xf7\x08\x02\x00\xff\x81\x15\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00U14Oph9\"<H5n\x00mysql_native_password\x00";
|
||||
const HANDSHAKE_MYSQL_8_0_18: &[u8] = b"\n8.0.18\x00\x19\x00\x00\x00\x114aB0c\x06g\x00\xff\xff\xff\x02\x00\xff\xc7\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tL\x03s\x0f[4\rl4. \x00caching_sha2_password\x00";
|
||||
@ -148,7 +147,7 @@ mod tests {
|
||||
|
||||
assert_eq!(p.server_default_collation, 255);
|
||||
assert!(p.status.contains(Status::SERVER_STATUS_AUTOCOMMIT));
|
||||
assert_matches!(p.auth_plugin, AuthPlugin::CachingSha2Password);
|
||||
assert!(matches!(p.auth_plugin, AuthPlugin::CachingSha2Password));
|
||||
|
||||
assert_eq!(
|
||||
&*p.auth_plugin_data,
|
||||
@ -196,7 +195,7 @@ mod tests {
|
||||
|
||||
assert_eq!(p.server_default_collation, 8);
|
||||
assert!(p.status.contains(Status::SERVER_STATUS_AUTOCOMMIT));
|
||||
assert_matches!(p.auth_plugin, AuthPlugin::MySqlNativePassword);
|
||||
assert!(matches!(p.auth_plugin, AuthPlugin::MySqlNativePassword));
|
||||
|
||||
assert_eq!(
|
||||
&*p.auth_plugin_data,
|
||||
|
@ -167,7 +167,6 @@ impl AuthenticationSaslContinue {
|
||||
mod tests {
|
||||
use super::Authentication;
|
||||
use crate::postgres::protocol::authentication::AuthenticationMd5;
|
||||
use matches::assert_matches;
|
||||
|
||||
const AUTH_OK: &[u8] = b"\0\0\0\0";
|
||||
const AUTH_MD5: &[u8] = b"\0\0\0\x05\x93\x189\x98";
|
||||
@ -176,7 +175,7 @@ mod tests {
|
||||
fn it_reads_auth_ok() {
|
||||
let m = Authentication::read(AUTH_OK).unwrap();
|
||||
|
||||
assert_matches!(m, Authentication::Ok);
|
||||
assert!(matches!(m, Authentication::Ok));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -184,7 +183,7 @@ mod tests {
|
||||
let m = Authentication::read(AUTH_MD5).unwrap();
|
||||
let data = AuthenticationMd5::read(&AUTH_MD5[4..]).unwrap();
|
||||
|
||||
assert_matches!(m, Authentication::Md5Password);
|
||||
assert!(matches!(m, Authentication::Md5Password));
|
||||
assert_eq!(data.salt, [147, 24, 57, 152]);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ impl ReadyForQuery {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{ReadyForQuery, TransactionStatus};
|
||||
use matches::assert_matches;
|
||||
|
||||
const READY_FOR_QUERY: &[u8] = b"E";
|
||||
|
||||
@ -50,6 +49,6 @@ mod tests {
|
||||
fn it_decodes_ready_for_query() {
|
||||
let message = ReadyForQuery::read(READY_FOR_QUERY).unwrap();
|
||||
|
||||
assert_matches!(message.status, TransactionStatus::Error);
|
||||
assert!(matches!(message.status, TransactionStatus::Error));
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,6 @@ impl Response {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Response, Severity};
|
||||
use matches::assert_matches;
|
||||
|
||||
const RESPONSE: &[u8] = b"SNOTICE\0VNOTICE\0C42710\0Mextension \"uuid-ossp\" already exists, \
|
||||
skipping\0Fextension.c\0L1656\0RCreateExtension\0\0";
|
||||
@ -237,7 +236,7 @@ mod tests {
|
||||
fn it_decodes_response() {
|
||||
let message = Response::read(RESPONSE).unwrap();
|
||||
|
||||
assert_matches!(message.severity, Severity::Notice);
|
||||
assert!(matches!(message.severity, Severity::Notice));
|
||||
assert_eq!(&*message.code, "42710");
|
||||
assert_eq!(&*message.file.unwrap(), "extension.c");
|
||||
assert_eq!(message.line, Some(1656));
|
||||
|
Loading…
x
Reference in New Issue
Block a user