Skip to content

Commit d84fa98

Browse files
committed
Variant cleanup
1 parent 3fb5043 commit d84fa98

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/error.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
//! Postgres errors
2-
31
use std::collections::HashMap;
42
use std::error;
5-
use std::io;
3+
use std::io::IoError;
64
use std::fmt;
75
use std::result;
86

9-
use openssl::ssl::error as sslerror;
7+
use openssl::ssl::error::SslError;
108
use phf;
119

1210
use Result;
@@ -365,7 +363,7 @@ pub enum ConnectError {
365363
/// The URL was missing a user
366364
MissingUser,
367365
/// An error from the Postgres server itself
368-
DbError(::error::DbError),
366+
DbError(DbError),
369367
/// A password was required but not provided in the URL
370368
MissingPassword,
371369
/// The Postgres server requested an authentication method not supported
@@ -374,9 +372,9 @@ pub enum ConnectError {
374372
/// The Postgres server does not support SSL encryption
375373
NoSslSupport,
376374
/// There was an error initializing the SSL session
377-
SslError(sslerror::SslError),
375+
SslError(SslError),
378376
/// There was an error communicating with the server
379-
IoError(io::IoError),
377+
IoError(IoError),
380378
/// The server sent an unexpected response
381379
BadResponse,
382380
}
@@ -415,8 +413,8 @@ impl error::Error for ConnectError {
415413
}
416414
}
417415

418-
impl error::FromError<io::IoError> for ConnectError {
419-
fn from_error(err: io::IoError) -> ConnectError {
416+
impl error::FromError<IoError> for ConnectError {
417+
fn from_error(err: IoError) -> ConnectError {
420418
ConnectError::IoError(err)
421419
}
422420
}
@@ -427,8 +425,8 @@ impl error::FromError<DbError> for ConnectError {
427425
}
428426
}
429427

430-
impl error::FromError<sslerror::SslError> for ConnectError {
431-
fn from_error(err: sslerror::SslError) -> ConnectError {
428+
impl error::FromError<SslError> for ConnectError {
429+
fn from_error(err: SslError) -> ConnectError {
432430
ConnectError::SslError(err)
433431
}
434432
}
@@ -596,7 +594,7 @@ pub enum Error {
596594
/// An error reported by the Postgres server
597595
DbError(::error::DbError),
598596
/// An error communicating with the Postgres server
599-
IoError(io::IoError),
597+
IoError(IoError),
600598
/// The communication channel with the Postgres server has desynchronized
601599
/// due to an earlier communications error.
602600
StreamDesynchronized,
@@ -699,8 +697,8 @@ impl error::FromError<DbError> for Error {
699697
}
700698
}
701699

702-
impl error::FromError<io::IoError> for Error {
703-
fn from_error(err: io::IoError) -> Error {
700+
impl error::FromError<IoError> for Error {
701+
fn from_error(err: IoError) -> Error {
704702
Error::IoError(err)
705703
}
706704
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! name VARCHAR NOT NULL,
3030
//! time_created TIMESTAMP NOT NULL,
3131
//! data BYTEA
32-
//! )", []).unwrap();
32+
//! )", &[]).unwrap();
3333
//! let me = Person {
3434
//! id: 0,
3535
//! name: "Steven".into_string(),
@@ -42,7 +42,7 @@
4242
//!
4343
//! let stmt = conn.prepare("SELECT id, name, time_created, data FROM person")
4444
//! .unwrap();
45-
//! for row in stmt.query([]).unwrap() {
45+
//! for row in stmt.query(&[]).unwrap() {
4646
//! let person = Person {
4747
//! id: row.get(0),
4848
//! name: row.get(1),

0 commit comments

Comments
 (0)