From 996f0633802267ce45cf7170d2c8a935f22b534e Mon Sep 17 00:00:00 2001 From: Bernardo Uriarte Blanco Date: Tue, 27 Oct 2020 20:31:15 +0100 Subject: [PATCH] map to convert to `&dyn ToSql` is not longer necessary --- postgres/src/client.rs | 2 +- tokio-postgres/src/client.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/postgres/src/client.rs b/postgres/src/client.rs index 8ea038da..f5637cdb 100644 --- a/postgres/src/client.rs +++ b/postgres/src/client.rs @@ -253,7 +253,7 @@ impl Client { /// ]; /// let mut it = client.query_raw( /// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2", - /// params.iter().map(|p| p as &dyn ToSql), + /// params, /// )?; /// /// while let Some(row) = it.next()? { diff --git a/tokio-postgres/src/client.rs b/tokio-postgres/src/client.rs index ecf3ea60..359a7cd1 100644 --- a/tokio-postgres/src/client.rs +++ b/tokio-postgres/src/client.rs @@ -318,9 +318,6 @@ impl Client { /// /// # Examples /// - /// If you have a type like `Vec` where `T: ToSql` Rust will not know how to use it as params. To get around - /// this the type must explicitly be converted to `&dyn ToSql`. - /// /// ```no_run /// # async fn async_main(client: &tokio_postgres::Client) -> Result<(), tokio_postgres::Error> { /// use tokio_postgres::types::ToSql; @@ -332,7 +329,7 @@ impl Client { /// ]; /// let mut it = client.query_raw( /// "SELECT foo FROM bar WHERE biz = $1 AND baz = $2", - /// params.iter().map(|p| p as &dyn ToSql), + /// params, /// ).await?; /// /// pin_mut!(it);