Skip to content

Commit 674e520

Browse files
committed
Stop using old format macros
1 parent 4beb5d8 commit 674e520

4 files changed

Lines changed: 25 additions & 25 deletions

File tree

lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub struct DefaultNoticeHandler;
146146

147147
impl PostgresNoticeHandler for DefaultNoticeHandler {
148148
fn handle(&mut self, notice: PostgresDbError) {
149-
info2!("{}: {}", notice.severity, notice.message);
149+
info!("{}: {}", notice.severity, notice.message);
150150
}
151151
}
152152

@@ -653,7 +653,7 @@ impl PostgresConnection {
653653
pub fn connect(url: &str) -> PostgresConnection {
654654
match PostgresConnection::try_connect(url) {
655655
Ok(conn) => conn,
656-
Err(err) => fail2!("Failed to connect: {}", err.to_str())
656+
Err(err) => fail!("Failed to connect: {}", err.to_str())
657657
}
658658
}
659659

@@ -698,7 +698,7 @@ impl PostgresConnection {
698698
pub fn prepare<'a>(&'a self, query: &str) -> NormalPostgresStatement<'a> {
699699
match self.try_prepare(query) {
700700
Ok(stmt) => stmt,
701-
Err(err) => fail2!("Error preparing statement:\n{}",
701+
Err(err) => fail!("Error preparing statement:\n{}",
702702
err.pretty_error(query))
703703
}
704704
}
@@ -740,7 +740,7 @@ impl PostgresConnection {
740740
pub fn update(&self, query: &str, params: &[&ToSql]) -> uint {
741741
match self.try_update(query, params) {
742742
Ok(res) => res,
743-
Err(err) => fail2!("Error running update:\n{}",
743+
Err(err) => fail!("Error running update:\n{}",
744744
err.pretty_error(query))
745745
}
746746
}
@@ -763,7 +763,7 @@ impl PostgresConnection {
763763
match conn.read_message() {
764764
ReadyForQuery {_} => break,
765765
ErrorResponse { fields } =>
766-
fail2!("Error: {}",
766+
fail!("Error: {}",
767767
PostgresDbError::new(fields).to_str()),
768768
_ => ()
769769
}
@@ -910,7 +910,7 @@ pub trait PostgresStatement {
910910
fn update(&self, params: &[&ToSql]) -> uint {
911911
match self.try_update(params) {
912912
Ok(count) => count,
913-
Err(err) => fail2!("Error running update\n{}", err.to_str())
913+
Err(err) => fail!("Error running update\n{}", err.to_str())
914914
}
915915
}
916916

@@ -932,7 +932,7 @@ pub trait PostgresStatement {
932932
fn query<'a>(&'a self, params: &[&ToSql]) -> PostgresResult<'a> {
933933
match self.try_query(params) {
934934
Ok(result) => result,
935-
Err(err) => fail2!("Error executing query:\n{}", err.to_str())
935+
Err(err) => fail!("Error executing query:\n{}", err.to_str())
936936
}
937937
}
938938

@@ -1168,7 +1168,7 @@ impl<'self> TransactionalPostgresStatement<'self> {
11681168
-> PostgresResult<'a> {
11691169
match self.try_lazy_query(row_limit, params) {
11701170
Ok(result) => result,
1171-
Err(err) => fail2!("Error executing query:\n{}", err.to_str())
1171+
Err(err) => fail!("Error executing query:\n{}", err.to_str())
11721172
}
11731173
}
11741174
}
@@ -1308,7 +1308,7 @@ impl<'self> RowIndex for &'self str {
13081308
fn idx(&self, stmt: &NormalPostgresStatement) -> uint {
13091309
match stmt.find_col_named(*self) {
13101310
Some(idx) => idx,
1311-
None => fail2!("No column with name {}", *self)
1311+
None => fail!("No column with name {}", *self)
13121312
}
13131313
}
13141314
}

message.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub trait WriteMessage {
139139

140140
impl<W: Writer> WriteMessage for W {
141141
fn write_message(&mut self, message: &FrontendMessage) {
142-
debug2!("Writing message {:?}", message);
142+
debug!("Writing message {:?}", message);
143143
let mut buf = MemWriter::new();
144144
let mut ident = None;
145145

@@ -298,10 +298,10 @@ impl<R: Reader> ReadMessage for R {
298298
't' => read_parameter_description(&mut buf),
299299
'T' => read_row_description(&mut buf),
300300
'Z' => ReadyForQuery { state: buf.read_u8_() },
301-
ident => fail2!("Unknown message identifier `{}`", ident)
301+
ident => fail!("Unknown message identifier `{}`", ident)
302302
};
303303
assert!(buf.eof());
304-
debug2!("Read message {:?}", ret);
304+
debug!("Read message {:?}", ret);
305305
ret
306306
}
307307
}
@@ -344,7 +344,7 @@ fn read_auth_message(buf: &mut MemReader) -> BackendMessage {
344344
6 => AuthenticationSCMCredential,
345345
7 => AuthenticationGSS,
346346
9 => AuthenticationSSPI,
347-
val => fail2!("Invalid authentication identifier `{}`", val)
347+
val => fail!("Invalid authentication identifier `{}`", val)
348348
}
349349
}
350350

tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn test_notification_iterator_some() {
437437
assert_eq!(&expected.channel, &channel);
438438
assert_eq!(&expected.payload, &payload);
439439
}
440-
x => fail2!("Expected {:?} but got {:?}", expected, x)
440+
x => fail!("Expected {:?} but got {:?}", expected, x)
441441
}
442442
}
443443

@@ -497,8 +497,8 @@ fn test_plaintext_pass_no_pass() {
497497
let ret = PostgresConnection::try_connect("postgres://pass_user@localhost/postgres");
498498
match ret {
499499
Err(MissingPassword) => (),
500-
Err(err) => fail2!("Unexpected error {}", err.to_str()),
501-
_ => fail2!("Expected error")
500+
Err(err) => fail!("Unexpected error {}", err.to_str()),
501+
_ => fail!("Expected error")
502502
}
503503
}
504504

@@ -507,8 +507,8 @@ fn test_plaintext_pass_wrong_pass() {
507507
let ret = PostgresConnection::try_connect("postgres://pass_user:asdf@localhost/postgres");
508508
match ret {
509509
Err(DbError(PostgresDbError { code: InvalidPassword, _ })) => (),
510-
Err(err) => fail2!("Unexpected error {}", err.to_str()),
511-
_ => fail2!("Expected error")
510+
Err(err) => fail!("Unexpected error {}", err.to_str()),
511+
_ => fail!("Expected error")
512512
}
513513
}
514514

@@ -522,8 +522,8 @@ fn test_md5_pass_no_pass() {
522522
let ret = PostgresConnection::try_connect("postgres://md5_user@localhost/postgres");
523523
match ret {
524524
Err(MissingPassword) => (),
525-
Err(err) => fail2!("Unexpected error {}", err.to_str()),
526-
_ => fail2!("Expected error")
525+
Err(err) => fail!("Unexpected error {}", err.to_str()),
526+
_ => fail!("Expected error")
527527
}
528528
}
529529

@@ -532,8 +532,8 @@ fn test_md5_pass_wrong_pass() {
532532
let ret = PostgresConnection::try_connect("postgres://md5_user:asdf@localhost/postgres");
533533
match ret {
534534
Err(DbError(PostgresDbError { code: InvalidPassword, _ })) => (),
535-
Err(err) => fail2!("Unexpected error {}", err.to_str()),
536-
_ => fail2!("Expected error")
535+
Err(err) => fail!("Unexpected error {}", err.to_str()),
536+
_ => fail!("Expected error")
537537
}
538538
}
539539

@@ -542,7 +542,7 @@ fn test_dns_failure() {
542542
let ret = PostgresConnection::try_connect("postgres://postgres@asdfasdfasdf");
543543
match ret {
544544
Err(DnsError) => (),
545-
Err(err) => fail2!("Unexpected error {}", err.to_str()),
546-
_ => fail2!("Expected error")
545+
Err(err) => fail!("Unexpected error {}", err.to_str()),
546+
_ => fail!("Expected error")
547547
}
548548
}

types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ macro_rules! check_types(
118118
($($expected:pat)|+, $actual:ident) => (
119119
match $actual {
120120
$($expected)|+ => (),
121-
actual => fail2!("Invalid Postgres type {:?}", actual)
121+
actual => fail!("Invalid Postgres type {:?}", actual)
122122
}
123123
)
124124
)

0 commit comments

Comments
 (0)