diff --git a/sqlx-core/src/mysql/types/chrono.rs b/sqlx-core/src/mysql/types/chrono.rs index 00b638e0..8c87c6f0 100644 --- a/sqlx-core/src/mysql/types/chrono.rs +++ b/sqlx-core/src/mysql/types/chrono.rs @@ -1,12 +1,12 @@ -use chrono::{NaiveDateTime, NaiveDate, Timelike, Datelike}; use byteorder::{ByteOrder, LittleEndian}; +use chrono::{Datelike, NaiveDate, NaiveDateTime, Timelike}; use crate::decode::{Decode, DecodeError}; use crate::encode::Encode; +use crate::mysql::protocol::Type; +use crate::mysql::types::MySqlTypeMetadata; use crate::mysql::MySql; use crate::types::HasSqlType; -use crate::mysql::types::{MySqlTypeMetadata}; -use crate::mysql::protocol::Type; use std::convert::TryFrom; impl HasSqlType for MySql { @@ -68,7 +68,7 @@ impl Decode for NaiveDateTime { LittleEndian::read_u32(&raw[8..]) } else { 0 - } + }, ) } else { date.and_hms(0, 0, 0) @@ -117,7 +117,7 @@ fn decode_date(raw: &[u8]) -> NaiveDate { NaiveDate::from_ymd( LittleEndian::read_u16(raw) as i32, raw[2] as u32, - raw[3] as u32 + raw[3] as u32, ) } diff --git a/sqlx-core/src/mysql/types/str.rs b/sqlx-core/src/mysql/types/str.rs index b4188f06..425a088a 100644 --- a/sqlx-core/src/mysql/types/str.rs +++ b/sqlx-core/src/mysql/types/str.rs @@ -4,7 +4,7 @@ use byteorder::LittleEndian; use crate::decode::{Decode, DecodeError}; use crate::encode::Encode; -use crate::mysql::io::{BufMutExt}; +use crate::mysql::io::BufMutExt; use crate::mysql::protocol::Type; use crate::mysql::types::MySqlTypeMetadata; use crate::mysql::MySql; diff --git a/sqlx-core/src/pool/inner.rs b/sqlx-core/src/pool/inner.rs index f6232586..ae96f2b5 100644 --- a/sqlx-core/src/pool/inner.rs +++ b/sqlx-core/src/pool/inner.rs @@ -48,14 +48,15 @@ where options, }); - for _ in 0.. pool.options.min_size { - let raw = pool.new_conn( - Instant::now() + pool.options.connect_timeout - ).await?; + for _ in 0..pool.options.min_size { + let raw = pool + .new_conn(Instant::now() + pool.options.connect_timeout) + .await?; - pool_tx.send(Idle { + pool_tx + .send(Idle { raw, - since: Instant::now() + since: Instant::now(), }) .await; } diff --git a/sqlx-core/src/pool/options.rs b/sqlx-core/src/pool/options.rs index c11ff576..f2c426bc 100644 --- a/sqlx-core/src/pool/options.rs +++ b/sqlx-core/src/pool/options.rs @@ -102,10 +102,12 @@ where } impl Default for Builder - where - DB: Database +where + DB: Database, { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } pub(crate) struct Options { diff --git a/sqlx-core/src/query_as.rs b/sqlx-core/src/query_as.rs index 9125b0e1..7f35aed7 100644 --- a/sqlx-core/src/query_as.rs +++ b/sqlx-core/src/query_as.rs @@ -3,8 +3,8 @@ use futures_util::{future, TryStreamExt}; use crate::arguments::Arguments; use crate::{ - arguments::IntoArguments, database::Database, encode::Encode, - executor::Executor, row::FromRow, types::HasSqlType, + arguments::IntoArguments, database::Database, encode::Encode, executor::Executor, row::FromRow, + types::HasSqlType, }; /// SQL query with bind parameters, which maps rows to an explicit output type. diff --git a/tests/postgres-macros.rs b/tests/postgres-macros.rs index a5137baf..d5d9a0f1 100644 --- a/tests/postgres-macros.rs +++ b/tests/postgres-macros.rs @@ -71,13 +71,13 @@ async fn query_by_string() -> sqlx::Result<()> { let string = "Hello, world!".to_string(); let result = sqlx::query!( - "SELECT * from (VALUES('Hello, world!')) strings(string)\ - where string = $1 or string = $2", - string, - string[..] - ) - .fetch_one(&mut conn) - .await?; + "SELECT * from (VALUES('Hello, world!')) strings(string)\ + where string = $1 or string = $2", + string, + string[..] + ) + .fetch_one(&mut conn) + .await?; assert_eq!(result.string, string);