From e57a2976e951ba4bfb47e41683bebd6df87fb314 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 29 Jan 2019 19:40:49 -0800 Subject: [PATCH] Fix clippy --- postgres/src/query.rs | 2 +- postgres/src/query_portal.rs | 2 +- postgres/src/test.rs | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/postgres/src/query.rs b/postgres/src/query.rs index 99332e53..4b2ae0b7 100644 --- a/postgres/src/query.rs +++ b/postgres/src/query.rs @@ -23,7 +23,7 @@ impl<'a> Query<'a> { } /// A convenience API which collects the resulting rows into a `Vec` and returns them. - pub fn to_vec(self) -> Result, Error> { + pub fn into_vec(self) -> Result, Error> { self.collect() } } diff --git a/postgres/src/query_portal.rs b/postgres/src/query_portal.rs index 75f380c2..824facc1 100644 --- a/postgres/src/query_portal.rs +++ b/postgres/src/query_portal.rs @@ -23,7 +23,7 @@ impl<'a> QueryPortal<'a> { } /// A convenience API which collects the resulting rows into a `Vec` and returns them. - pub fn to_vec(self) -> Result, Error> { + pub fn into_vec(self) -> Result, Error> { self.collect() } } diff --git a/postgres/src/test.rs b/postgres/src/test.rs index 89e71bc3..f9d7ec9b 100644 --- a/postgres/src/test.rs +++ b/postgres/src/test.rs @@ -20,7 +20,11 @@ fn query_prepared() { let mut client = Client::connect("host=localhost port=5433 user=postgres", NoTls).unwrap(); let stmt = client.prepare("SELECT $1::TEXT").unwrap(); - let rows = client.query(&stmt, &[&"hello"]).unwrap().to_vec().unwrap(); + let rows = client + .query(&stmt, &[&"hello"]) + .unwrap() + .into_vec() + .unwrap(); assert_eq!(rows.len(), 1); assert_eq!(rows[0].get::<_, &str>(0), "hello"); } @@ -32,7 +36,7 @@ fn query_unprepared() { let rows = client .query("SELECT $1::TEXT", &[&"hello"]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 1); assert_eq!(rows[0].get::<_, &str>(0), "hello"); @@ -57,7 +61,7 @@ fn transaction_commit() { let rows = client .query("SELECT * FROM foo", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 1); assert_eq!(rows[0].get::<_, i32>(0), 1); @@ -82,7 +86,7 @@ fn transaction_rollback() { let rows = client .query("SELECT * FROM foo", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 0); } @@ -106,7 +110,7 @@ fn transaction_drop() { let rows = client .query("SELECT * FROM foo", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 0); } @@ -136,7 +140,7 @@ fn nested_transactions() { let rows = transaction .query("SELECT id FROM foo ORDER BY id", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 1); assert_eq!(rows[0].get::<_, i32>(0), 1); @@ -160,7 +164,7 @@ fn nested_transactions() { let rows = client .query("SELECT id FROM foo ORDER BY id", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 3); assert_eq!(rows[0].get::<_, i32>(0), 1); @@ -187,7 +191,7 @@ fn copy_in() { let rows = client .query("SELECT id, name FROM foo ORDER BY id", &[]) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 2); @@ -246,7 +250,7 @@ fn portal() { let rows = transaction .query_portal(&portal, 2) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 2); assert_eq!(rows[0].get::<_, i32>(0), 1); @@ -255,7 +259,7 @@ fn portal() { let rows = transaction .query_portal(&portal, 2) .unwrap() - .to_vec() + .into_vec() .unwrap(); assert_eq!(rows.len(), 1); assert_eq!(rows[0].get::<_, i32>(0), 3);