diff --git a/codegen/src/sqlstate.rs b/codegen/src/sqlstate.rs index 791e47b1..a84d523a 100644 --- a/codegen/src/sqlstate.rs +++ b/codegen/src/sqlstate.rs @@ -60,7 +60,8 @@ impl SqlState {{ &self.0 }} " - ).unwrap(); + ) + .unwrap(); } fn make_consts(codes: &LinkedHashMap>, file: &mut BufWriter) { @@ -74,7 +75,8 @@ fn make_consts(codes: &LinkedHashMap>, file: &mut BufWriter< "#, name = name, code = code, - ).unwrap(); + ) + .unwrap(); } } @@ -87,7 +89,8 @@ fn make_map(codes: &LinkedHashMap>, file: &mut BufWriter = " - ).unwrap(); + ) + .unwrap(); let mut builder = phf_codegen::Map::new(); for (code, names) in codes { builder.entry(&**code, &format!("SqlState::{}", &names[0])); diff --git a/codegen/src/type_gen.rs b/codegen/src/type_gen.rs index 0f742d69..6c9c89a5 100644 --- a/codegen/src/type_gen.rs +++ b/codegen/src/type_gen.rs @@ -132,7 +132,8 @@ pub struct Other {{ pub schema: String, }} " - ).unwrap(); + ) + .unwrap(); } fn make_enum(w: &mut BufWriter, types: &BTreeMap) { @@ -141,7 +142,8 @@ fn make_enum(w: &mut BufWriter, types: &BTreeMap) { " #[derive(PartialEq, Eq, Clone, Debug)] pub enum Inner {{" - ).unwrap(); + ) + .unwrap(); for type_ in types.values() { write!( @@ -149,7 +151,8 @@ pub enum Inner {{" " {},", type_.variant - ).unwrap(); + ) + .unwrap(); } write!( @@ -159,7 +162,8 @@ pub enum Inner {{" }} " - ).unwrap(); + ) + .unwrap(); } fn make_impl(w: &mut BufWriter, types: &BTreeMap) { @@ -169,7 +173,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { pub fn from_oid(oid: Oid) -> Option {{ match oid {{ ", - ).unwrap(); + ) + .unwrap(); for (oid, type_) in types { write!( @@ -177,7 +182,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { " {} => Some(Inner::{}), ", oid, type_.variant - ).unwrap(); + ) + .unwrap(); } write!( @@ -189,7 +195,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { pub fn oid(&self) -> Oid {{ match *self {{ ", - ).unwrap(); + ) + .unwrap(); for (oid, type_) in types { write!( @@ -197,7 +204,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { " Inner::{} => {}, ", type_.variant, oid - ).unwrap(); + ) + .unwrap(); } write!( @@ -209,7 +217,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { pub fn kind(&self) -> &Kind {{ match *self {{ ", - ).unwrap(); + ) + .unwrap(); for type_ in types.values() { let kind = match type_.kind { @@ -227,7 +236,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { }} ", type_.variant, kind - ).unwrap(); + ) + .unwrap(); } write!( @@ -239,7 +249,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { pub fn name(&self) -> &str {{ match *self {{ "#, - ).unwrap(); + ) + .unwrap(); for type_ in types.values() { write!( @@ -247,7 +258,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { r#" Inner::{} => "{}", "#, type_.variant, type_.name - ).unwrap(); + ) + .unwrap(); } write!( @@ -257,7 +269,8 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { }} }} " - ).unwrap(); + ) + .unwrap(); } fn make_consts(w: &mut BufWriter, types: &BTreeMap) { @@ -272,7 +285,8 @@ fn make_consts(w: &mut BufWriter, types: &BTreeMap) { docs = type_.doc, ident = type_.ident, variant = type_.variant - ).unwrap(); + ) + .unwrap(); } write!(w, "}}").unwrap(); diff --git a/postgres-protocol/src/types.rs b/postgres-protocol/src/types.rs index b5d65cb3..7a764a9d 100644 --- a/postgres-protocol/src/types.rs +++ b/postgres-protocol/src/types.rs @@ -167,7 +167,10 @@ pub fn float8_from_sql(mut buf: &[u8]) -> Result(values: I, buf: &mut Vec) -> Result<(), StdBox> +pub fn hstore_to_sql<'a, I>( + values: I, + buf: &mut Vec, +) -> Result<(), StdBox> where I: IntoIterator)>, { @@ -228,7 +231,9 @@ impl<'a> FallibleIterator for HstoreEntries<'a> { type Error = StdBox; #[inline] - fn next(&mut self) -> Result)>, StdBox> { + fn next( + &mut self, + ) -> Result)>, StdBox> { if self.remaining == 0 { if !self.buf.is_empty() { return Err("invalid buffer size".into()); @@ -288,7 +293,9 @@ where /// Deserializes a `VARBIT` or `BIT` value. #[inline] -pub fn varbit_from_sql<'a>(mut buf: &'a [u8]) -> Result, StdBox> { +pub fn varbit_from_sql<'a>( + mut buf: &'a [u8], +) -> Result, StdBox> { let len = buf.read_i32::()?; if len < 0 { return Err("invalid varbit length".into()); @@ -1053,7 +1060,8 @@ mod test { None => Ok(IsNull::Yes), }, &mut buf, - ).unwrap(); + ) + .unwrap(); let array = array_from_sql(&buf).unwrap(); assert_eq!(array.has_nulls(), true); @@ -1089,7 +1097,8 @@ mod test { None => Ok(IsNull::Yes), }, &mut buf, - ).unwrap(); + ) + .unwrap(); let array = array_from_sql(&buf).unwrap(); assert_eq!(array.has_nulls(), false); diff --git a/tokio-postgres-native-tls/src/test.rs b/tokio-postgres-native-tls/src/test.rs index 15371ad6..f98b563f 100644 --- a/tokio-postgres-native-tls/src/test.rs +++ b/tokio-postgres-native-tls/src/test.rs @@ -38,7 +38,8 @@ fn require() { let connector = native_tls::TlsConnector::builder() .add_root_certificate( Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(), - ).build() + ) + .build() .unwrap(); smoke_test( tokio_postgres::Builder::new() @@ -53,7 +54,8 @@ fn prefer() { let connector = native_tls::TlsConnector::builder() .add_root_certificate( Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(), - ).build() + ) + .build() .unwrap(); smoke_test( tokio_postgres::Builder::new() @@ -68,7 +70,8 @@ fn scram_user() { let connector = native_tls::TlsConnector::builder() .add_root_certificate( Certificate::from_pem(include_bytes!("../../test/server.crt")).unwrap(), - ).build() + ) + .build() .unwrap(); smoke_test( tokio_postgres::Builder::new() diff --git a/tokio-postgres/src/proto/client.rs b/tokio-postgres/src/proto/client.rs index bae395ad..1931773b 100644 --- a/tokio-postgres/src/proto/client.rs +++ b/tokio-postgres/src/proto/client.rs @@ -161,7 +161,12 @@ impl Client { QueryStream::new(self.clone(), pending, portal.clone()) } - pub fn copy_in(&self, statement: &Statement, params: &[&dyn ToSql], stream: S) -> CopyInFuture + pub fn copy_in( + &self, + statement: &Statement, + params: &[&dyn ToSql], + stream: S, + ) -> CopyInFuture where S: Stream, S::Item: IntoBuf, @@ -236,7 +241,11 @@ impl Client { } } - fn excecute_message(&self, statement: &Statement, params: &[&dyn ToSql]) -> Result, Error> { + fn excecute_message( + &self, + statement: &Statement, + params: &[&dyn ToSql], + ) -> Result, Error> { let mut buf = self.bind_message(statement, "", params)?; frontend::execute("", 0, &mut buf).map_err(Error::parse)?; frontend::sync(&mut buf); diff --git a/tokio-postgres/src/types/chrono.rs b/tokio-postgres/src/types/chrono.rs index 5d5e7ce0..ed8a5c14 100644 --- a/tokio-postgres/src/types/chrono.rs +++ b/tokio-postgres/src/types/chrono.rs @@ -1,6 +1,4 @@ -use chrono::{ - DateTime, Duration, FixedOffset, Local, NaiveDate, NaiveDateTime, NaiveTime, Utc, -}; +use chrono::{DateTime, Duration, FixedOffset, Local, NaiveDate, NaiveDateTime, NaiveTime, Utc}; use postgres_protocol::types; use std::error::Error; diff --git a/tokio-postgres/src/types/geo.rs b/tokio-postgres/src/types/geo.rs index 40983a2f..95c0603c 100644 --- a/tokio-postgres/src/types/geo.rs +++ b/tokio-postgres/src/types/geo.rs @@ -1,5 +1,5 @@ -use geo::{Coordinate, LineString, Point, Rect}; use fallible_iterator::FallibleIterator; +use geo::{Coordinate, LineString, Point, Rect}; use postgres_protocol::types; use std::error::Error; diff --git a/tokio-postgres/src/types/uuid.rs b/tokio-postgres/src/types/uuid.rs index 2e34d01c..e68acf97 100644 --- a/tokio-postgres/src/types/uuid.rs +++ b/tokio-postgres/src/types/uuid.rs @@ -1,6 +1,6 @@ -use uuid::Uuid; use postgres_protocol::types; use std::error::Error; +use uuid::Uuid; use types::{FromSql, IsNull, ToSql, Type};