From 60e1f3c02f43479dac717d96442847a55f0ae72b Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Sun, 5 Feb 2017 17:30:53 -0500 Subject: [PATCH] Add more explicit types in unit tests. --- src/cache.rs | 6 +++++- src/lib.rs | 4 ++-- src/named_params.rs | 12 ++++++------ src/transaction.rs | 8 +++++--- src/types/mod.rs | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/cache.rs b/src/cache.rs index cba4e75..203fbce 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -258,7 +258,11 @@ mod test { { let mut stmt = db.prepare_cached(sql).unwrap(); assert_eq!(1i32, - stmt.query_map(&[], |r| r.get(0)).unwrap().next().unwrap().unwrap()); + stmt.query_map::(&[], |r| r.get(0)) + .unwrap() + .next() + .unwrap() + .unwrap()); } db.execute_batch(r#" diff --git a/src/lib.rs b/src/lib.rs index 1a10816..bde632c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1333,7 +1333,7 @@ mod test { db.execute("INSERT INTO foo(x) VALUES (?)", &[&2i32]).unwrap()); assert_eq!(3i32, - db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap()); + db.query_row::("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap()); } #[test] @@ -1449,7 +1449,7 @@ mod test { db.execute_batch(sql).unwrap(); assert_eq!(10i64, - db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)) + db.query_row::("SELECT SUM(x) FROM foo", &[], |r| r.get(0)) .unwrap()); let result: Result = db.query_row("SELECT x FROM foo WHERE x > 5", &[], |r| r.get(0)); diff --git a/src/named_params.rs b/src/named_params.rs index 23bd5ff..f1307f8 100644 --- a/src/named_params.rs +++ b/src/named_params.rs @@ -229,9 +229,9 @@ mod test { 1); assert_eq!(3i32, - db.query_row_named("SELECT SUM(x) FROM foo WHERE x > :x", - &[(":x", &0i32)], - |r| r.get(0)) + db.query_row_named::("SELECT SUM(x) FROM foo WHERE x > :x", + &[(":x", &0i32)], + |r| r.get(0)) .unwrap()); } @@ -246,9 +246,9 @@ mod test { stmt.execute_named(&[(":name", &"one")]).unwrap(); assert_eq!(1i32, - db.query_row_named("SELECT COUNT(*) FROM test WHERE name = :name", - &[(":name", &"one")], - |r| r.get(0)) + db.query_row_named::("SELECT COUNT(*) FROM test WHERE name = :name", + &[(":name", &"one")], + |r| r.get(0)) .unwrap()); } diff --git a/src/transaction.rs b/src/transaction.rs index 6243994..6fa3fe2 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -427,7 +427,8 @@ mod test { { let tx = db.transaction().unwrap(); assert_eq!(2i32, - tx.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap()); + tx.query_row::("SELECT SUM(x) FROM foo", &[], |r| r.get(0)) + .unwrap()); } } @@ -453,7 +454,8 @@ mod test { { let tx = db.transaction().unwrap(); assert_eq!(6i32, - tx.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap()); + tx.query_row::("SELECT SUM(x) FROM foo", &[], |r| r.get(0)) + .unwrap()); } } @@ -547,7 +549,7 @@ mod test { } fn assert_current_sum(x: i32, conn: &Connection) { - let i = conn.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap(); + let i = conn.query_row::("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap(); assert_eq!(x, i); } } diff --git a/src/types/mod.rs b/src/types/mod.rs index 1a49231..c62e0c2 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -175,7 +175,7 @@ mod test { db.execute("INSERT INTO foo(i) VALUES (?)", &[&Value::Integer(10)]).unwrap(); assert_eq!(10i64, - db.query_row("SELECT i FROM foo", &[], |r| r.get(0)).unwrap()); + db.query_row::("SELECT i FROM foo", &[], |r| r.get(0)).unwrap()); } #[test]