Skip to content

Commit d7b10f2

Browse files
committed
cleanup
1 parent 09e8656 commit d7b10f2

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

postgres-types/src/lib.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,9 @@ pub trait ToSql: fmt::Debug {
836836
) -> Result<IsNull, Box<dyn Error + Sync + Send>>;
837837

838838
/// Specify the encode format
839-
fn encode_format(&self) -> Format { Format::Binary }
839+
fn encode_format(&self) -> Format {
840+
Format::Binary
841+
}
840842
}
841843

842844
/// Supported Postgres message format types
@@ -849,17 +851,6 @@ pub enum Format {
849851
Binary,
850852
}
851853

852-
/// Convert from `Format` to the Postgres integer representation of those formats
853-
impl From<Format> for i16 {
854-
fn from(format: Format) -> Self {
855-
match format {
856-
Format::Text => 0,
857-
Format::Binary => 1,
858-
}
859-
}
860-
}
861-
862-
863854
impl<'a, T> ToSql for &'a T
864855
where
865856
T: ToSql,

tokio-postgres/src/query.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ where
156156
I: IntoIterator<Item = P>,
157157
I::IntoIter: ExactSizeIterator,
158158
{
159-
let (param_formats, params):(Vec<_>, Vec<_>) = params.into_iter().map(|p|->(i16, P){(p.borrow_to_sql().encode_format().into(),p)}).unzip();
159+
let (param_formats, params): (Vec<_>, Vec<_>) = params
160+
.into_iter()
161+
.map(|p| { (p.borrow_to_sql().encode_format() as i16, p) })
162+
.unzip();
160163
let params = params.into_iter();
161164

162165
assert!(

0 commit comments

Comments
 (0)