diff --git a/tests/Cargo.lock b/tests/Cargo.lock index 824e3d6..8df7e4b 100644 --- a/tests/Cargo.lock +++ b/tests/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "bitflags" version = "1.2.1" @@ -8,14 +10,14 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "diesel" version = "2.0.0" -source = "git+https://github.com/diesel-rs/diesel#f307a4b980e3fbe22e4438cd2d73a8a47f88b563" +source = "git+https://github.com/diesel-rs/diesel#72bfb356b8038e993634f095b57e54fdf1cfd8f9" dependencies = [ "bitflags", "byteorder", @@ -41,7 +43,7 @@ dependencies = [ [[package]] name = "diesel_derives" version = "2.0.0" -source = "git+https://github.com/diesel-rs/diesel#f307a4b980e3fbe22e4438cd2d73a8a47f88b563" +source = "git+https://github.com/diesel-rs/diesel#72bfb356b8038e993634f095b57e54fdf1cfd8f9" dependencies = [ "proc-macro2", "quote", @@ -50,9 +52,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", "percent-encoding", @@ -60,18 +62,18 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] [[package]] name = "idna" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -86,9 +88,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "libsqlite3-sys" -version = "0.20.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d31059f22935e6c31830db5249ba2b7ecd54fd73a9909286f0a67aa55c2fbd" +checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d" dependencies = [ "pkg-config", "vcpkg", @@ -133,27 +135,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] name = "syn" -version = "1.0.60" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ "proc-macro2", "quote", @@ -170,9 +172,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" dependencies = [ "tinyvec_macros", ] @@ -185,39 +187,39 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" dependencies = [ "matches", ] [[package]] name = "unicode-normalization" -version = "0.1.16" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "url" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", "idna", @@ -227,6 +229,6 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" diff --git a/tests/src/common/mod.rs b/tests/src/common/mod.rs index 31574b6..b6f0d70 100644 --- a/tests/src/common/mod.rs +++ b/tests/src/common/mod.rs @@ -44,7 +44,7 @@ pub struct Simple { pub fn get_connection() -> PgConnection { let database_url = ::std::env::var("PG_TEST_DATABASE_URL").expect("Env var PG_TEST_DATABASE_URL not set"); - let conn = PgConnection::establish(&database_url) + let mut conn = PgConnection::establish(&database_url) .expect(&format!("Failed to connect to {}", database_url)); conn.execute("SET search_path TO pg_temp;").unwrap(); conn @@ -91,7 +91,7 @@ pub fn sample_data() -> Vec { } #[cfg(feature = "postgres")] -pub fn create_table(conn: &PgConnection) { +pub fn create_table(conn: &mut PgConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -106,7 +106,7 @@ pub fn create_table(conn: &PgConnection) { } #[cfg(feature = "mysql")] -pub fn create_table(conn: &MysqlConnection) { +pub fn create_table(conn: &mut MysqlConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -120,7 +120,7 @@ pub fn create_table(conn: &MysqlConnection) { } #[cfg(feature = "sqlite")] -pub fn create_table(conn: &SqliteConnection) { +pub fn create_table(conn: &mut SqliteConnection) { conn.execute( r#" CREATE TABLE test_simple ( diff --git a/tests/src/complex_join.rs b/tests/src/complex_join.rs index 9da32cd..dc015da 100644 --- a/tests/src/complex_join.rs +++ b/tests/src/complex_join.rs @@ -59,7 +59,7 @@ struct Server { } #[cfg(feature = "postgres")] -pub fn create_table(conn: &PgConnection) { +pub fn create_table(conn: &mut PgConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -80,8 +80,8 @@ pub fn create_table(conn: &PgConnection) { #[test] #[cfg(feature = "postgres")] fn test_complex_join() { - let conn = get_connection(); - create_table(&conn); + let conn = &mut get_connection(); + create_table(conn); let some_users = vec![User { id: 1 }, User { id: 2 }]; let some_servers = vec![ Server { @@ -102,11 +102,11 @@ fn test_complex_join() { ]; diesel::insert_into(users::table) .values(&some_users) - .execute(&conn) + .execute(conn) .unwrap(); diesel::insert_into(servers::table) .values(&some_servers) - .execute(&conn) + .execute(conn) .unwrap(); let (user, server) = users::table .find(1) @@ -115,7 +115,7 @@ fn test_complex_join() { .eq(users::dsl::id) .and(servers::dsl::status.eq(ServerStatus::Started))), ) - .first::<(User, Option)>(&conn) + .first::<(User, Option)>(conn) .unwrap(); assert_eq!(user, User { id: 1 }); assert_eq!( diff --git a/tests/src/nullable.rs b/tests/src/nullable.rs index aa4e83e..4057010 100644 --- a/tests/src/nullable.rs +++ b/tests/src/nullable.rs @@ -37,7 +37,7 @@ struct MaybeNullable { } #[cfg(feature = "postgres")] -pub fn create_null_table(conn: &PgConnection) { +pub fn create_null_table(conn: &mut PgConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -53,7 +53,7 @@ pub fn create_null_table(conn: &PgConnection) { } #[cfg(feature = "mysql")] -pub fn create_null_table(conn: &MysqlConnection) { +pub fn create_null_table(conn: &mut MysqlConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -67,7 +67,7 @@ pub fn create_null_table(conn: &MysqlConnection) { } #[cfg(feature = "sqlite")] -pub fn create_null_table(conn: &SqliteConnection) { +pub fn create_null_table(conn: &mut SqliteConnection) { conn.execute( r#" CREATE TABLE test_nullable ( @@ -81,8 +81,8 @@ pub fn create_null_table(conn: &SqliteConnection) { #[test] fn nullable_enum_round_trip() { - let connection = get_connection(); - create_null_table(&connection); + let connection = &mut get_connection(); + create_null_table(connection); let data = vec![ Nullable { id: 1, @@ -94,16 +94,16 @@ fn nullable_enum_round_trip() { }, ]; let sql = insert_into(test_nullable::table).values(&data); - let ct = sql.execute(&connection).unwrap(); + let ct = sql.execute(connection).unwrap(); assert_eq!(data.len(), ct); - let items = test_nullable::table.load::(&connection).unwrap(); + let items = test_nullable::table.load::(connection).unwrap(); assert_eq!(data, items); } #[test] fn not_nullable_enum_round_trip() { - let connection = get_connection(); - create_null_table(&connection); + let connection = &mut get_connection(); + create_null_table(connection); let data = vec![ MaybeNullable { id: 1, @@ -116,7 +116,7 @@ fn not_nullable_enum_round_trip() { ]; let ct = insert_into(test_nullable::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); assert_eq!(data.len(), ct); } diff --git a/tests/src/pg_array.rs b/tests/src/pg_array.rs index 0e0d989..d6b9210 100644 --- a/tests/src/pg_array.rs +++ b/tests/src/pg_array.rs @@ -3,7 +3,7 @@ use diesel::prelude::*; use crate::common::*; -pub fn create_table(conn: &PgConnection) { +pub fn create_table(conn: &mut PgConnection) { use diesel::connection::SimpleConnection; conn.batch_execute( r#" @@ -19,8 +19,8 @@ pub fn create_table(conn: &PgConnection) { #[test] fn enum_query() { - let connection = get_connection(); - create_table(&connection); + let connection = &mut get_connection(); + create_table(connection); let data_item = TestArray { id: 1, my_enum_arr: vec![MyEnum::Foo], @@ -28,12 +28,12 @@ fn enum_query() { let data = vec![data_item]; let ct = insert_into(test_array::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); assert_eq!(data.len(), ct); let item = test_array::table .find(1) - .get_results::(&connection) + .get_results::(connection) .unwrap(); assert_eq!(data, item); } diff --git a/tests/src/rename.rs b/tests/src/rename.rs index 0358f43..ae5aa84 100644 --- a/tests/src/rename.rs +++ b/tests/src/rename.rs @@ -59,7 +59,7 @@ fn rename_round_trip() { renamed: SomeEnum::WithASpace, }, ]; - let connection = get_connection(); + let connection = &mut get_connection(); connection .batch_execute( r#" @@ -73,7 +73,7 @@ fn rename_round_trip() { .unwrap(); let inserted = insert_into(test_rename::table) .values(&data) - .get_results(&connection) + .get_results(connection) .unwrap(); assert_eq!(data, inserted); } @@ -93,7 +93,7 @@ fn rename_round_trip() { renamed: SomeEnum::WithASpace, }, ]; - let connection = get_connection(); + let connection = &mut get_connection(); connection .batch_execute( r#" @@ -106,8 +106,8 @@ fn rename_round_trip() { .unwrap(); insert_into(test_rename::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); - let inserted = test_rename::table.load::(&connection).unwrap(); + let inserted = test_rename::table.load::(connection).unwrap(); assert_eq!(data, inserted); } diff --git a/tests/src/simple.rs b/tests/src/simple.rs index 46f09e3..669b4d9 100644 --- a/tests/src/simple.rs +++ b/tests/src/simple.rs @@ -6,15 +6,15 @@ use crate::common::*; #[test] #[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))] fn enum_round_trip() { - let connection = get_connection(); - create_table(&connection); + let connection = &mut get_connection(); + create_table(connection); let data = sample_data(); let ct = insert_into(test_simple::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); assert_eq!(data.len(), ct); - let items = test_simple::table.load::(&connection).unwrap(); + let items = test_simple::table.load::(connection).unwrap(); assert_eq!(data, items); } @@ -22,18 +22,18 @@ fn enum_round_trip() { #[cfg(any(feature = "sqlite", feature = "postgres", feature = "mysql"))] fn filter_by_enum() { use crate::common::test_simple::dsl::*; - let connection = get_connection(); - create_table(&connection); + let connection = &mut get_connection(); + create_table(connection); let data = sample_data(); let ct = insert_into(test_simple) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); assert_eq!(data.len(), ct); let results = test_simple .filter(my_enum.eq(MyEnum::Foo)) .limit(2) - .load::(&connection) + .load::(connection) .unwrap(); assert_eq!( results, @@ -53,7 +53,7 @@ fn filter_by_enum() { #[test] #[cfg(feature = "sqlite")] fn sqlite_invalid_enum() { - let connection = get_connection(); + let connection = &mut get_connection(); let data = sample_data(); connection .execute( @@ -67,7 +67,7 @@ fn sqlite_invalid_enum() { .unwrap(); if let Err(e) = insert_into(test_simple::table) .values(&data) - .execute(&connection) + .execute(connection) { let err = format!("{}", e); assert!(err.contains("CHECK constraint failed")); diff --git a/tests/src/value_style.rs b/tests/src/value_style.rs index 39cdc34..d2dbc92 100644 --- a/tests/src/value_style.rs +++ b/tests/src/value_style.rs @@ -76,7 +76,7 @@ fn stylized_round_trip() { use diesel::connection::SimpleConnection; use diesel::insert_into; let data = sample_data(); - let connection = get_connection(); + let connection = &mut get_connection(); connection .batch_execute( r#" @@ -91,7 +91,7 @@ fn stylized_round_trip() { .unwrap(); let inserted = insert_into(test_value_style::table) .values(&data) - .get_results(&connection) + .get_results(connection) .unwrap(); assert_eq!(data, inserted); } @@ -102,7 +102,7 @@ fn stylized_round_trip() { use diesel::connection::SimpleConnection; use diesel::insert_into; let data = sample_data(); - let connection = get_connection(); + let connection = &mut get_connection(); connection .batch_execute( r#" @@ -116,10 +116,10 @@ fn stylized_round_trip() { .unwrap(); insert_into(test_value_style::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); let inserted = test_value_style::table - .load::(&connection) + .load::(connection) .unwrap(); assert_eq!(data, inserted); } @@ -130,7 +130,7 @@ fn stylized_round_trip() { use diesel::connection::SimpleConnection; use diesel::insert_into; let data = sample_data(); - let connection = get_connection(); + let connection = &mut get_connection(); connection .batch_execute( r#" @@ -145,10 +145,10 @@ fn stylized_round_trip() { .unwrap(); insert_into(test_value_style::table) .values(&data) - .execute(&connection) + .execute(connection) .unwrap(); let inserted = test_value_style::table - .load::(&connection) + .load::(connection) .unwrap(); assert_eq!(data, inserted); }