diff --git a/sqlx-core/src/acquire.rs b/sqlx-core/src/acquire.rs index 5ae760cf..8229295a 100644 --- a/sqlx-core/src/acquire.rs +++ b/sqlx-core/src/acquire.rs @@ -1,7 +1,7 @@ #[cfg(feature = "async")] use futures_util::future::BoxFuture; -use crate::{Connection, Database, Runtime}; +use crate::{Connection, Runtime}; #[allow(clippy::type_complexity)] pub trait Acquire { diff --git a/sqlx-core/src/blocking/acquire.rs b/sqlx-core/src/blocking/acquire.rs index 22b5599a..b5bb8977 100644 --- a/sqlx-core/src/blocking/acquire.rs +++ b/sqlx-core/src/blocking/acquire.rs @@ -1,5 +1,4 @@ use super::Runtime; -use crate::Database; pub trait Acquire: crate::Acquire where @@ -25,7 +24,3 @@ where where Self::Connection: Sized; } - -// TODO: impl Acquire for &Pool { ... } -// TODO: impl Acquire for &mut C { ... } -// TODO: impl Acquire for &mut &A { ... } diff --git a/sqlx-core/src/decode.rs b/sqlx-core/src/decode.rs index 25d03d17..3381fa79 100644 --- a/sqlx-core/src/decode.rs +++ b/sqlx-core/src/decode.rs @@ -3,7 +3,7 @@ use std::fmt::{self, Display, Formatter}; use std::str::Utf8Error; use crate::database::HasRawValue; -use crate::{Database, Runtime}; +use crate::Database; /// A type that can be decoded from a SQL value. pub trait Decode<'r, Db: Database>: Sized + Send + Sync { diff --git a/sqlx-core/src/encode.rs b/sqlx-core/src/encode.rs index fbc870e9..81df1480 100644 --- a/sqlx-core/src/encode.rs +++ b/sqlx-core/src/encode.rs @@ -1,8 +1,8 @@ use std::error::Error as StdError; use std::fmt::{self, Display, Formatter}; -use crate::database::{HasOutput, HasRawValue}; -use crate::{Database, Runtime}; +use crate::database::HasOutput; +use crate::Database; /// A type that can be encoded into a SQL value. pub trait Encode: Send + Sync { diff --git a/sqlx-core/src/executor.rs b/sqlx-core/src/executor.rs index 719f8e68..f0de10d6 100644 --- a/sqlx-core/src/executor.rs +++ b/sqlx-core/src/executor.rs @@ -1,7 +1,7 @@ #[cfg(feature = "async")] use futures_util::future::{self, BoxFuture, FutureExt, TryFutureExt}; -use crate::{Database, Error, Result, Runtime}; +use crate::{Database, Runtime}; /// Describes a type that can execute SQL queries on a self-provided database connection. /// @@ -21,7 +21,7 @@ pub trait Executor { fn execute<'x, 'e, 'q>( &'e mut self, sql: &'q str, - ) -> BoxFuture<'x, Result<::QueryResult>> + ) -> BoxFuture<'x, crate::Result<::QueryResult>> where Rt: crate::Async, 'e: 'x, @@ -31,7 +31,7 @@ pub trait Executor { fn fetch_all<'x, 'e, 'q>( &'e mut self, sql: &'q str, - ) -> BoxFuture<'x, Result::Row>>> + ) -> BoxFuture<'x, crate::Result::Row>>> where Rt: crate::Async, 'e: 'x, @@ -41,7 +41,7 @@ pub trait Executor { fn fetch_optional<'x, 'e, 'q>( &'e mut self, sql: &'q str, - ) -> BoxFuture<'x, Result::Row>>> + ) -> BoxFuture<'x, crate::Result::Row>>> where Rt: crate::Async, 'e: 'x, @@ -51,7 +51,7 @@ pub trait Executor { fn fetch_one<'x, 'e, 'q>( &'e mut self, sql: &'q str, - ) -> BoxFuture<'x, Result<::Row>> + ) -> BoxFuture<'x, crate::Result<::Row>> where Rt: crate::Async, 'e: 'x, @@ -60,7 +60,7 @@ pub trait Executor { self.fetch_optional(sql) .and_then(|maybe_row| match maybe_row { Some(row) => future::ok(row), - None => future::err(Error::RowNotFound), + None => future::err(crate::Error::RowNotFound), }) .boxed() } diff --git a/sqlx-core/src/options.rs b/sqlx-core/src/options.rs index eab7f862..5e2a6832 100644 --- a/sqlx-core/src/options.rs +++ b/sqlx-core/src/options.rs @@ -1,8 +1,6 @@ use std::fmt::Debug; use std::str::FromStr; -use crate::Connect; - /// Options which can be used to configure how a SQL connection is opened. #[allow(clippy::module_name_repetitions)] pub trait ConnectOptions: @@ -12,7 +10,7 @@ pub trait ConnectOptions: #[cfg(feature = "async")] fn connect(&self) -> futures_util::future::BoxFuture<'_, crate::Result> where - C: Connect + Sized, + C: crate::Connect + Sized, Rt: crate::Async, { C::connect_with(self) diff --git a/sqlx-core/src/row.rs b/sqlx-core/src/row.rs index 52f2ca31..2edc9100 100644 --- a/sqlx-core/src/row.rs +++ b/sqlx-core/src/row.rs @@ -1,5 +1,5 @@ use crate::database::HasRawValue; -use crate::{Column, Database, Decode, Runtime}; +use crate::{Database, Decode}; pub trait Row: 'static + Send + Sync { type Database: Database; diff --git a/sqlx-mysql/src/options.rs b/sqlx-mysql/src/options.rs index 76284602..42546785 100644 --- a/sqlx-mysql/src/options.rs +++ b/sqlx-mysql/src/options.rs @@ -1,11 +1,8 @@ use std::fmt::{self, Debug, Formatter}; -use std::marker::PhantomData; use std::path::PathBuf; use either::Either; -use sqlx_core::{ConnectOptions, Result, Runtime}; - -use crate::MySqlConnection; +use sqlx_core::ConnectOptions; mod builder; mod default; diff --git a/sqlx-mysql/src/options/builder.rs b/sqlx-mysql/src/options/builder.rs index 274a8186..71a067d3 100644 --- a/sqlx-mysql/src/options/builder.rs +++ b/sqlx-mysql/src/options/builder.rs @@ -2,7 +2,6 @@ use std::mem; use std::path::{Path, PathBuf}; use either::Either; -use sqlx_core::Runtime; impl super::MySqlConnectOptions { /// Sets the hostname of the database server. diff --git a/sqlx-mysql/src/options/getters.rs b/sqlx-mysql/src/options/getters.rs index c401defa..42f4dd3c 100644 --- a/sqlx-mysql/src/options/getters.rs +++ b/sqlx-mysql/src/options/getters.rs @@ -1,7 +1,5 @@ use std::path::{Path, PathBuf}; -use sqlx_core::Runtime; - use super::{default, MySqlConnectOptions}; impl MySqlConnectOptions { diff --git a/sqlx-mysql/src/output.rs b/sqlx-mysql/src/output.rs index c54971d8..5dec3828 100644 --- a/sqlx-mysql/src/output.rs +++ b/sqlx-mysql/src/output.rs @@ -1,7 +1,3 @@ -use bytes::BufMut; - -use crate::MySqlTypeId; - // https://dev.mysql.com/doc/internals/en/com-stmt-execute.html // 'x: single execution diff --git a/sqlx-mysql/src/row.rs b/sqlx-mysql/src/row.rs index 2ede1691..687db509 100644 --- a/sqlx-mysql/src/row.rs +++ b/sqlx-mysql/src/row.rs @@ -1,7 +1,5 @@ -use std::marker::PhantomData; - use bytes::Bytes; -use sqlx_core::{Decode, Error, Row, Runtime}; +use sqlx_core::{Decode, Error, Row}; use crate::{protocol, MySql, MySqlColumn, MySqlRawValue, MySqlRawValueFormat}; diff --git a/sqlx-mysql/src/types/bool.rs b/sqlx-mysql/src/types/bool.rs index c2d88539..e23faa05 100644 --- a/sqlx-mysql/src/types/bool.rs +++ b/sqlx-mysql/src/types/bool.rs @@ -1,8 +1,7 @@ -use bytes::BufMut; use sqlx_core::{decode, encode}; use sqlx_core::{Decode, Encode}; -use crate::{MySql, MySqlOutput, MySqlRawValue, MySqlTypeId, MySqlTypeInfo}; +use crate::{MySql, MySqlOutput, MySqlRawValue, MySqlTypeInfo}; // In MySQL, a boolean is an alias for `TINYINT(1) UNSIGNED` // the functions below delegate functionality to the `u8` impls diff --git a/sqlx-mysql/src/types/str.rs b/sqlx-mysql/src/types/str.rs index 3374fc6d..a090729a 100644 --- a/sqlx-mysql/src/types/str.rs +++ b/sqlx-mysql/src/types/str.rs @@ -1,11 +1,8 @@ -use bytes::Buf; -use sqlx_core::database::HasOutput; use sqlx_core::{decode, encode}; -use sqlx_core::{Database, Decode, Encode}; +use sqlx_core::{Decode, Encode}; use crate::type_info::MySqlTypeInfo; -use crate::MySqlRawValueFormat::*; -use crate::{MySql, MySqlOutput, MySqlRawValue, MySqlTypeId}; +use crate::{MySql, MySqlOutput, MySqlRawValue}; // https://dev.mysql.com/doc/internals/en/binary-protocol-value.html#packet-ProtocolBinary diff --git a/sqlx-mysql/src/types/uint.rs b/sqlx-mysql/src/types/uint.rs index eeeaf6c0..a4970cbf 100644 --- a/sqlx-mysql/src/types/uint.rs +++ b/sqlx-mysql/src/types/uint.rs @@ -1,11 +1,10 @@ use bytes::Buf; -use sqlx_core::database::HasOutput; use sqlx_core::{decode, encode}; -use sqlx_core::{Database, Decode, Encode}; +use sqlx_core::{Decode, Encode}; use crate::type_info::MySqlTypeInfo; use crate::MySqlRawValueFormat::*; -use crate::{MySql, MySqlOutput, MySqlRawValue, MySqlTypeId}; +use crate::{MySql, MySqlOutput, MySqlRawValue}; // https://dev.mysql.com/doc/internals/en/binary-protocol-value.html#packet-ProtocolBinary