From 618e8e9d6f05e2a9b9e8e2e8305928ba229a52e1 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 22 Jan 2021 15:13:22 +0100 Subject: [PATCH 1/2] Remove any::AnyType It was not actually used in a meaningful way. --- sqlx-core/src/any/mod.rs | 1 - sqlx-core/src/any/type.rs | 214 +------------------------------------- 2 files changed, 1 insertion(+), 214 deletions(-) diff --git a/sqlx-core/src/any/mod.rs b/sqlx-core/src/any/mod.rs index be6ea90c56..a5f794820d 100644 --- a/sqlx-core/src/any/mod.rs +++ b/sqlx-core/src/any/mod.rs @@ -35,7 +35,6 @@ pub use encode::AnyEncode; pub use kind::AnyKind; pub use options::AnyConnectOptions; pub use query_result::AnyQueryResult; -pub use r#type::AnyType; pub use row::AnyRow; pub use statement::AnyStatement; pub use transaction::AnyTransactionManager; diff --git a/sqlx-core/src/any/type.rs b/sqlx-core/src/any/type.rs index 4a9a3aa99d..3df4136b65 100644 --- a/sqlx-core/src/any/type.rs +++ b/sqlx-core/src/any/type.rs @@ -1,17 +1,3 @@ -use crate::types::Type; - -#[cfg(feature = "postgres")] -use crate::postgres::Postgres; - -#[cfg(feature = "mysql")] -use crate::mysql::MySql; - -#[cfg(feature = "mssql")] -use crate::mssql::Mssql; - -#[cfg(feature = "sqlite")] -use crate::sqlite::Sqlite; - // Type is required by the bounds of the [`Row`] and [`Arguments`] trait but its been overridden in // AnyRow and AnyArguments to not use this implementation; but instead, delegate to the // database-specific implementation. @@ -20,10 +6,7 @@ use crate::sqlite::Sqlite; // for the [`Any`] driver. macro_rules! impl_any_type { ($ty:ty) => { - impl crate::types::Type for $ty - where - $ty: crate::any::AnyType, - { + impl crate::types::Type for $ty { fn type_info() -> crate::any::AnyTypeInfo { // FIXME: nicer panic explaining why this isn't possible unimplemented!() @@ -55,198 +38,3 @@ macro_rules! impl_any_type { } }; } - -// FIXME: Find a nice way to auto-generate the below or petition Rust to add support for #[cfg] -// to trait bounds - -// all 4 - -#[cfg(all( - feature = "postgres", - feature = "mysql", - feature = "mssql", - feature = "sqlite" -))] -pub trait AnyType: Type + Type + Type + Type {} - -#[cfg(all( - feature = "postgres", - feature = "mysql", - feature = "mssql", - feature = "sqlite" -))] -impl AnyType for T where T: Type + Type + Type + Type {} - -// only 3 (4) - -#[cfg(all( - not(feature = "mssql"), - all(feature = "postgres", feature = "mysql", feature = "sqlite") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "mssql"), - all(feature = "postgres", feature = "mysql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "mysql"), - all(feature = "postgres", feature = "mssql", feature = "sqlite") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "mysql"), - all(feature = "postgres", feature = "mssql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "sqlite"), - all(feature = "postgres", feature = "mysql", feature = "mssql") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "sqlite"), - all(feature = "postgres", feature = "mysql", feature = "mssql") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "postgres"), - all(feature = "sqlite", feature = "mysql", feature = "mssql") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "postgres"), - all(feature = "sqlite", feature = "mysql", feature = "mssql") -))] -impl AnyType for T where T: Type + Type + Type {} - -// only 2 (6) - -#[cfg(all( - not(any(feature = "mssql", feature = "sqlite")), - all(feature = "postgres", feature = "mysql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mssql", feature = "sqlite")), - all(feature = "postgres", feature = "mysql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "sqlite")), - all(feature = "postgres", feature = "mssql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "sqlite")), - all(feature = "postgres", feature = "mssql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql")), - all(feature = "postgres", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql")), - all(feature = "postgres", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "sqlite")), - all(feature = "mssql", feature = "mysql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "sqlite")), - all(feature = "mssql", feature = "mysql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mysql")), - all(feature = "mssql", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mysql")), - all(feature = "mssql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql")), - all(feature = "mysql", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql")), - all(feature = "mysql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -// only 1 (4) - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "sqlite")), - feature = "postgres" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "sqlite")), - feature = "postgres" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql", feature = "sqlite")), - feature = "mysql" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql", feature = "sqlite")), - feature = "mysql" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "postgres", feature = "sqlite")), - feature = "mssql" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "postgres", feature = "sqlite")), - feature = "mssql" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "postgres")), - feature = "sqlite" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "postgres")), - feature = "sqlite" -))] -impl AnyType for T where T: Type {} From 1be8d1938837fafb202595504c76bc4e6324f007 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 22 Jan 2021 15:25:57 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6f5a9944..ec39735cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,11 +25,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [[#976]] Remove the `Done` trait. The `.rows_affected()` method is now available as an inherent method on `PgQueryResult`, `MySqlQueryResult` and so on. [[@jplatte]] -- [[#983]] Upgrade async runtime dependencies [[@seryl, @ant32, @jplatte]] +- [[#983]] Upgrade async runtime dependencies [[@seryl], [@ant32], [@jplatte]] - tokio 1.0 - actix-rt 2.0 +- [[#1007]] Remove `any::AnyType` [[@jplatte]] + ## 0.4.2 - 2020-12-19 - [[#908]] Fix `whoami` crash on FreeBSD platform [[@fundon]] [[@AldaronLau]]