diff --git a/postgres-types/src/lib.rs b/postgres-types/src/lib.rs index f4f88085..48f6b5d4 100644 --- a/postgres-types/src/lib.rs +++ b/postgres-types/src/lib.rs @@ -836,7 +836,9 @@ pub trait ToSql: fmt::Debug { ) -> Result>; /// Specify the encode format - fn encode_format(&self) -> Format { Format::Binary } + fn encode_format(&self) -> Format { + Format::Binary + } } /// Supported Postgres message format types @@ -849,17 +851,6 @@ pub enum Format { Binary, } -/// Convert from `Format` to the Postgres integer representation of those formats -impl From for i16 { - fn from(format: Format) -> Self { - match format { - Format::Text => 0, - Format::Binary => 1, - } - } -} - - impl<'a, T> ToSql for &'a T where T: ToSql, diff --git a/tokio-postgres/src/query.rs b/tokio-postgres/src/query.rs index af57e2ae..965a21a4 100644 --- a/tokio-postgres/src/query.rs +++ b/tokio-postgres/src/query.rs @@ -156,7 +156,10 @@ where I: IntoIterator, I::IntoIter: ExactSizeIterator, { - let (param_formats, params):(Vec<_>, Vec<_>) = params.into_iter().map(|p|->(i16, P){(p.borrow_to_sql().encode_format().into(),p)}).unzip(); + let (param_formats, params): (Vec<_>, Vec<_>) = params + .into_iter() + .map(|p| { (p.borrow_to_sql().encode_format() as i16, p) }) + .unzip(); let params = params.into_iter(); assert!(