From 302db717aa141e71e18887612c4d818b761e0132 Mon Sep 17 00:00:00 2001 From: James Tomlinson Date: Fri, 28 Aug 2020 16:30:56 +0100 Subject: [PATCH] Fix formatting (cargo fmt) --- sqlx-core/src/sqlite/types/mod.rs | 4 ++-- sqlx-core/src/sqlite/types/uuid.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sqlx-core/src/sqlite/types/mod.rs b/sqlx-core/src/sqlite/types/mod.rs index 34f32891..e2d3e5f4 100644 --- a/sqlx-core/src/sqlite/types/mod.rs +++ b/sqlx-core/src/sqlite/types/mod.rs @@ -42,10 +42,10 @@ mod bool; mod bytes; #[cfg(feature = "chrono")] mod chrono; -#[cfg(feature = "uuid")] -mod uuid; mod float; mod int; #[cfg(feature = "json")] mod json; mod str; +#[cfg(feature = "uuid")] +mod uuid; diff --git a/sqlx-core/src/sqlite/types/uuid.rs b/sqlx-core/src/sqlite/types/uuid.rs index 0de47fdb..6c3a71db 100644 --- a/sqlx-core/src/sqlite/types/uuid.rs +++ b/sqlx-core/src/sqlite/types/uuid.rs @@ -1,20 +1,20 @@ -use uuid::{adapter::Hyphenated, Uuid}; -use std::borrow::Cow; use crate::decode::Decode; use crate::encode::{Encode, IsNull}; use crate::error::BoxDynError; use crate::sqlite::type_info::DataType; use crate::sqlite::{Sqlite, SqliteArgumentValue, SqliteTypeInfo, SqliteValueRef}; use crate::types::Type; +use std::borrow::Cow; +use uuid::{adapter::Hyphenated, Uuid}; impl Type for Uuid { fn type_info() -> SqliteTypeInfo { SqliteTypeInfo(DataType::Blob) } - + fn compatible(ty: &SqliteTypeInfo) -> bool { matches!(ty.0, DataType::Blob | DataType::Text) - } + } } impl<'q> Encode<'q, Sqlite> for &'q Uuid { @@ -48,7 +48,8 @@ impl<'q> Encode<'q, Sqlite> for &'q Hyphenated { impl Decode<'_, Sqlite> for Hyphenated { fn decode(value: SqliteValueRef<'_>) -> Result { - let uuid: Result = Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into); + let uuid: Result = + Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into); Ok(uuid?.to_hyphenated()) } }