Fix some clippy warnings
This commit is contained in:
parent
9c1068253f
commit
b4c4b692a1
@ -403,7 +403,7 @@ fn test_lazy_query() {
|
|||||||
or_panic!(trans.execute("CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)", &[]));
|
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 stmt = or_panic!(trans.prepare("INSERT INTO foo (id) VALUES ($1)"));
|
||||||
let values = vec!(0i32, 1, 2, 3, 4, 5);
|
let values = vec!(0i32, 1, 2, 3, 4, 5);
|
||||||
for value in values.iter() {
|
for value in &values {
|
||||||
or_panic!(stmt.execute(&[value]));
|
or_panic!(stmt.execute(&[value]));
|
||||||
}
|
}
|
||||||
let stmt = or_panic!(trans.prepare("SELECT id FROM foo ORDER BY id"));
|
let stmt = or_panic!(trans.prepare("SELECT id FROM foo ORDER BY id"));
|
||||||
@ -534,13 +534,13 @@ fn test_get_off_by_one() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_custom_notice_handler() {
|
fn test_custom_notice_handler() {
|
||||||
static mut count: usize = 0;
|
static mut COUNT: usize = 0;
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
impl HandleNotice for Handler {
|
impl HandleNotice for Handler {
|
||||||
fn handle_notice(&mut self, notice: DbError) {
|
fn handle_notice(&mut self, notice: DbError) {
|
||||||
assert_eq!("note", notice.message);
|
assert_eq!("note", notice.message);
|
||||||
unsafe { count += 1; }
|
unsafe { COUNT += 1; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +554,7 @@ fn test_custom_notice_handler() {
|
|||||||
END; $$ LANGUAGE plpgsql", &[]));
|
END; $$ LANGUAGE plpgsql", &[]));
|
||||||
or_panic!(conn.execute("SELECT pg_temp.note()", &[]));
|
or_panic!(conn.execute("SELECT pg_temp.note()", &[]));
|
||||||
|
|
||||||
assert_eq!(unsafe { count }, 1);
|
assert_eq!(unsafe { COUNT }, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1069,8 +1069,8 @@ fn transaction_config() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn transaction_config_one_setting() {
|
fn transaction_config_one_setting() {
|
||||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
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().read_only(true)).unwrap();
|
||||||
conn.set_transaction_config(&transaction::Config::new().deferrable(true)).unwrap();
|
conn.set_transaction_config(transaction::Config::new().deferrable(true)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -302,8 +302,8 @@ fn composite() {
|
|||||||
let stmt = conn.prepare("SELECT $1::inventory_item").unwrap();
|
let stmt = conn.prepare("SELECT $1::inventory_item").unwrap();
|
||||||
let type_ = &stmt.param_types()[0];
|
let type_ = &stmt.param_types()[0];
|
||||||
assert_eq!(type_.name(), "inventory_item");
|
assert_eq!(type_.name(), "inventory_item");
|
||||||
match type_.kind() {
|
match *type_.kind() {
|
||||||
&Kind::Composite(ref fields) => {
|
Kind::Composite(ref fields) => {
|
||||||
assert_eq!(fields[0].name(), "name");
|
assert_eq!(fields[0].name(), "name");
|
||||||
assert_eq!(fields[0].type_(), &Type::Text);
|
assert_eq!(fields[0].type_(), &Type::Text);
|
||||||
assert_eq!(fields[1].name(), "supplier");
|
assert_eq!(fields[1].name(), "supplier");
|
||||||
@ -311,7 +311,7 @@ fn composite() {
|
|||||||
assert_eq!(fields[2].name(), "price");
|
assert_eq!(fields[2].name(), "price");
|
||||||
assert_eq!(fields[2].type_(), &Type::Numeric);
|
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 stmt = conn.prepare("SELECT $1::mood").unwrap();
|
||||||
let type_ = &stmt.param_types()[0];
|
let type_ = &stmt.param_types()[0];
|
||||||
assert_eq!(type_.name(), "mood");
|
assert_eq!(type_.name(), "mood");
|
||||||
match type_.kind() {
|
match *type_.kind() {
|
||||||
&Kind::Enum(ref variants) => {
|
Kind::Enum(ref variants) => {
|
||||||
assert_eq!(variants, &["sad".to_owned(), "ok".to_owned(), "happy".to_owned()]);
|
assert_eq!(variants, &["sad".to_owned(), "ok".to_owned(), "happy".to_owned()]);
|
||||||
}
|
}
|
||||||
_ => panic!("bad type"),
|
_ => panic!("bad type"),
|
||||||
|
Loading…
Reference in New Issue
Block a user