From f264873999688d69702b583c72d8a2874ce51092 Mon Sep 17 00:00:00 2001 From: Tim Hutt Date: Thu, 22 Oct 2020 21:56:59 +0100 Subject: [PATCH] Cargo format --- src/types/from_sql.rs | 2 +- src/types/mod.rs | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/types/from_sql.rs b/src/types/from_sql.rs index 4890a90..a309c89 100644 --- a/src/types/from_sql.rs +++ b/src/types/from_sql.rs @@ -1,7 +1,7 @@ use super::{Value, ValueRef}; +use std::convert::TryInto; use std::error::Error; use std::fmt; -use std::convert::TryInto; /// Enum listing possible errors from `FromSql` trait. #[derive(Debug)] diff --git a/src/types/mod.rs b/src/types/mod.rs index 8d0e1e7..7868f18 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -132,7 +132,7 @@ impl fmt::Display for Type { #[cfg(test)] mod test { use super::Value; - use crate::{Connection, Error, NO_PARAMS, params, Statement}; + use crate::{params, Connection, Error, Statement, NO_PARAMS}; use std::f64::EPSILON; use std::os::raw::{c_double, c_int}; @@ -388,18 +388,24 @@ mod test { macro_rules! test_conversion { ($db_etc:ident, $insert_value:expr, $get_type:ty, expect $expected_value:expr) => { - $db_etc.insert_statement.execute(params![$insert_value]).unwrap(); - let res = $db_etc.query_statement.query_row(NO_PARAMS, |row| { - row.get::<_, $get_type>(0) - }); + $db_etc + .insert_statement + .execute(params![$insert_value]) + .unwrap(); + let res = $db_etc + .query_statement + .query_row(NO_PARAMS, |row| row.get::<_, $get_type>(0)); assert_eq!(res.unwrap(), $expected_value); $db_etc.delete_statement.execute(NO_PARAMS).unwrap(); }; ($db_etc:ident, $insert_value:expr, $get_type:ty, expect_error) => { - $db_etc.insert_statement.execute(params![$insert_value]).unwrap(); - let res = $db_etc.query_statement.query_row(NO_PARAMS, |row| { - row.get::<_, $get_type>(0) - }); + $db_etc + .insert_statement + .execute(params![$insert_value]) + .unwrap(); + let res = $db_etc + .query_statement + .query_row(NO_PARAMS, |row| row.get::<_, $get_type>(0)); res.unwrap_err(); $db_etc.delete_statement.execute(NO_PARAMS).unwrap(); }; @@ -455,6 +461,5 @@ mod test { // Float to int conversion, never works even if the actual value is an // integer. test_conversion!(db_etc, 0f64, i64, expect_error); - } }