Skip to content

Commit e57a297

Browse files
committed
Fix clippy
1 parent df84dd8 commit e57a297

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

postgres/src/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a> Query<'a> {
2323
}
2424

2525
/// A convenience API which collects the resulting rows into a `Vec` and returns them.
26-
pub fn to_vec(self) -> Result<Vec<Row>, Error> {
26+
pub fn into_vec(self) -> Result<Vec<Row>, Error> {
2727
self.collect()
2828
}
2929
}

postgres/src/query_portal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a> QueryPortal<'a> {
2323
}
2424

2525
/// A convenience API which collects the resulting rows into a `Vec` and returns them.
26-
pub fn to_vec(self) -> Result<Vec<Row>, Error> {
26+
pub fn into_vec(self) -> Result<Vec<Row>, Error> {
2727
self.collect()
2828
}
2929
}

postgres/src/test.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ fn query_prepared() {
2020
let mut client = Client::connect("host=localhost port=5433 user=postgres", NoTls).unwrap();
2121

2222
let stmt = client.prepare("SELECT $1::TEXT").unwrap();
23-
let rows = client.query(&stmt, &[&"hello"]).unwrap().to_vec().unwrap();
23+
let rows = client
24+
.query(&stmt, &[&"hello"])
25+
.unwrap()
26+
.into_vec()
27+
.unwrap();
2428
assert_eq!(rows.len(), 1);
2529
assert_eq!(rows[0].get::<_, &str>(0), "hello");
2630
}
@@ -32,7 +36,7 @@ fn query_unprepared() {
3236
let rows = client
3337
.query("SELECT $1::TEXT", &[&"hello"])
3438
.unwrap()
35-
.to_vec()
39+
.into_vec()
3640
.unwrap();
3741
assert_eq!(rows.len(), 1);
3842
assert_eq!(rows[0].get::<_, &str>(0), "hello");
@@ -57,7 +61,7 @@ fn transaction_commit() {
5761
let rows = client
5862
.query("SELECT * FROM foo", &[])
5963
.unwrap()
60-
.to_vec()
64+
.into_vec()
6165
.unwrap();
6266
assert_eq!(rows.len(), 1);
6367
assert_eq!(rows[0].get::<_, i32>(0), 1);
@@ -82,7 +86,7 @@ fn transaction_rollback() {
8286
let rows = client
8387
.query("SELECT * FROM foo", &[])
8488
.unwrap()
85-
.to_vec()
89+
.into_vec()
8690
.unwrap();
8791
assert_eq!(rows.len(), 0);
8892
}
@@ -106,7 +110,7 @@ fn transaction_drop() {
106110
let rows = client
107111
.query("SELECT * FROM foo", &[])
108112
.unwrap()
109-
.to_vec()
113+
.into_vec()
110114
.unwrap();
111115
assert_eq!(rows.len(), 0);
112116
}
@@ -136,7 +140,7 @@ fn nested_transactions() {
136140
let rows = transaction
137141
.query("SELECT id FROM foo ORDER BY id", &[])
138142
.unwrap()
139-
.to_vec()
143+
.into_vec()
140144
.unwrap();
141145
assert_eq!(rows.len(), 1);
142146
assert_eq!(rows[0].get::<_, i32>(0), 1);
@@ -160,7 +164,7 @@ fn nested_transactions() {
160164
let rows = client
161165
.query("SELECT id FROM foo ORDER BY id", &[])
162166
.unwrap()
163-
.to_vec()
167+
.into_vec()
164168
.unwrap();
165169
assert_eq!(rows.len(), 3);
166170
assert_eq!(rows[0].get::<_, i32>(0), 1);
@@ -187,7 +191,7 @@ fn copy_in() {
187191
let rows = client
188192
.query("SELECT id, name FROM foo ORDER BY id", &[])
189193
.unwrap()
190-
.to_vec()
194+
.into_vec()
191195
.unwrap();
192196

193197
assert_eq!(rows.len(), 2);
@@ -246,7 +250,7 @@ fn portal() {
246250
let rows = transaction
247251
.query_portal(&portal, 2)
248252
.unwrap()
249-
.to_vec()
253+
.into_vec()
250254
.unwrap();
251255
assert_eq!(rows.len(), 2);
252256
assert_eq!(rows[0].get::<_, i32>(0), 1);
@@ -255,7 +259,7 @@ fn portal() {
255259
let rows = transaction
256260
.query_portal(&portal, 2)
257261
.unwrap()
258-
.to_vec()
262+
.into_vec()
259263
.unwrap();
260264
assert_eq!(rows.len(), 1);
261265
assert_eq!(rows[0].get::<_, i32>(0), 3);

0 commit comments

Comments
 (0)