From b4c4b692a1f536150cf23967ce8d8859ef43202f Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 19 Nov 2016 16:04:28 -0800 Subject: [PATCH] Fix some clippy warnings --- tests/test.rs | 12 ++++++------ tests/types/mod.rs | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test.rs b/tests/test.rs index 9411e6d7..20ffab1b 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -403,7 +403,7 @@ fn test_lazy_query() { or_panic!(trans.execute("CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)", &[])); let stmt = or_panic!(trans.prepare("INSERT INTO foo (id) VALUES ($1)")); let values = vec!(0i32, 1, 2, 3, 4, 5); - for value in values.iter() { + for value in &values { or_panic!(stmt.execute(&[value])); } let stmt = or_panic!(trans.prepare("SELECT id FROM foo ORDER BY id")); @@ -534,13 +534,13 @@ fn test_get_off_by_one() { #[test] fn test_custom_notice_handler() { - static mut count: usize = 0; + static mut COUNT: usize = 0; struct Handler; impl HandleNotice for Handler { fn handle_notice(&mut self, notice: DbError) { assert_eq!("note", notice.message); - unsafe { count += 1; } + unsafe { COUNT += 1; } } } @@ -554,7 +554,7 @@ fn test_custom_notice_handler() { END; $$ LANGUAGE plpgsql", &[])); or_panic!(conn.execute("SELECT pg_temp.note()", &[])); - assert_eq!(unsafe { count }, 1); + assert_eq!(unsafe { COUNT }, 1); } #[test] @@ -1069,8 +1069,8 @@ fn transaction_config() { #[test] fn transaction_config_one_setting() { let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap(); - conn.set_transaction_config(&transaction::Config::new().read_only(true)).unwrap(); - conn.set_transaction_config(&transaction::Config::new().deferrable(true)).unwrap(); + conn.set_transaction_config(transaction::Config::new().read_only(true)).unwrap(); + conn.set_transaction_config(transaction::Config::new().deferrable(true)).unwrap(); } #[test] diff --git a/tests/types/mod.rs b/tests/types/mod.rs index 42cdba9d..7d9ae081 100644 --- a/tests/types/mod.rs +++ b/tests/types/mod.rs @@ -302,8 +302,8 @@ fn composite() { let stmt = conn.prepare("SELECT $1::inventory_item").unwrap(); let type_ = &stmt.param_types()[0]; assert_eq!(type_.name(), "inventory_item"); - match type_.kind() { - &Kind::Composite(ref fields) => { + match *type_.kind() { + Kind::Composite(ref fields) => { assert_eq!(fields[0].name(), "name"); assert_eq!(fields[0].type_(), &Type::Text); assert_eq!(fields[1].name(), "supplier"); @@ -311,7 +311,7 @@ fn composite() { assert_eq!(fields[2].name(), "price"); assert_eq!(fields[2].type_(), &Type::Numeric); } - t => panic!("bad type {:?}", t), + ref t => panic!("bad type {:?}", t), } } @@ -323,8 +323,8 @@ fn enum_() { let stmt = conn.prepare("SELECT $1::mood").unwrap(); let type_ = &stmt.param_types()[0]; assert_eq!(type_.name(), "mood"); - match type_.kind() { - &Kind::Enum(ref variants) => { + match *type_.kind() { + Kind::Enum(ref variants) => { assert_eq!(variants, &["sad".to_owned(), "ok".to_owned(), "happy".to_owned()]); } _ => panic!("bad type"),