Skip to content

Commit e8ff196

Browse files
committed
Cleanup
1 parent 42eb9fb commit e8ff196

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

src/lib.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
//!
55
//! ```rust,no_run
66
//! extern crate postgres;
7-
//! # #[cfg(feature = "time")]
87
//! extern crate time;
98
//!
10-
//! # #[cfg(not(feature = "time"))] fn main() {}
11-
//! # #[cfg(feature = "time")] fn main() {
129
//! use time::Timespec;
1310
//!
1411
//! use postgres::{Connection, SslMode};
@@ -36,8 +33,7 @@
3633
//! time_created: time::get_time(),
3734
//! data: None
3835
//! };
39-
//! conn.execute("INSERT INTO person (name, time_created, data)
40-
//! VALUES ($1, $2, $3)",
36+
//! conn.execute("INSERT INTO person (name, time_created, data) VALUES ($1, $2, $3)",
4137
//! &[&me.name, &me.time_created, &me.data]).unwrap();
4238
//!
4339
//! let stmt = conn.prepare("SELECT id, name, time_created, data FROM person")
@@ -52,53 +48,52 @@
5248
//! println!("Found person {}", person.name);
5349
//! }
5450
//! }
55-
//! # }
5651
//! ```
5752
#![doc(html_root_url="https://sfackler.github.io/doc")]
5853
#![feature(globs, macro_rules, phase, unsafe_destructor, slicing_syntax, default_type_params)]
5954
#![warn(missing_docs)]
6055

56+
#[phase(plugin, link)]
57+
extern crate log;
6158
extern crate openssl;
62-
extern crate serialize;
6359
extern crate phf;
6460
#[phase(plugin)]
6561
extern crate phf_mac;
66-
#[phase(plugin, link)]
67-
extern crate log;
62+
extern crate serialize;
6863
extern crate time;
6964

70-
use url::Url;
7165
use openssl::crypto::hash::{HashType, Hasher};
7266
use openssl::ssl::{SslContext, MaybeSslStream};
7367
use serialize::hex::ToHex;
7468
use std::cell::{Cell, RefCell};
7569
use std::cmp::max;
7670
use std::collections::{RingBuf, HashMap};
71+
use std::fmt;
7772
use std::io::{BufferedStream, IoResult, IoError, IoErrorKind};
7873
use std::io::net::ip::Port;
7974
use std::iter::IteratorCloneExt;
80-
use std::time::Duration;
8175
use std::mem;
82-
use std::fmt;
8376
use std::result;
77+
use std::time::Duration;
78+
use url::Url;
8479

80+
pub use error::{Error, ConnectError, SqlState, DbError, ErrorPosition};
81+
#[doc(inline)]
82+
pub use types::{Oid, Type, ToSql, FromSql};
8583
use io::{InternalStream, Timeout};
86-
use message::{FrontendMessage, BackendMessage, RowDescriptionEntry};
87-
use message::FrontendMessage::*;
8884
use message::BackendMessage::*;
85+
use message::FrontendMessage::*;
86+
use message::{FrontendMessage, BackendMessage, RowDescriptionEntry};
8987
use message::{WriteMessage, ReadMessage};
90-
#[doc(inline)]
91-
pub use types::{Oid, Type, ToSql, FromSql};
92-
pub use error::{Error, ConnectError, SqlState, DbError, ErrorPosition};
9388

9489
#[macro_escape]
9590
mod macros;
9691

92+
mod error;
9793
mod io;
9894
mod message;
9995
mod url;
10096
mod util;
101-
mod error;
10297
pub mod types;
10398

10499
const CANARY: u32 = 0xdeadbeef;
@@ -319,7 +314,6 @@ impl<'conn> Notifications<'conn> {
319314
}
320315
Err(e) => return Err(Error::IoError(e)),
321316
}
322-
323317
}
324318
}
325319
}
@@ -669,8 +663,8 @@ impl InnerConnection {
669663
if let Some(name) = self.unknown_types.get(&oid) {
670664
return Ok(name.clone());
671665
}
672-
let name = try!(self.quick_query(&*format!("SELECT typname FROM pg_type \
673-
WHERE oid={}", oid)))
666+
let name = try!(self.quick_query(&*format!("SELECT typname FROM pg_type WHERE oid={}",
667+
oid)))
674668
.into_iter().next().unwrap().into_iter().next().unwrap().unwrap();
675669
self.unknown_types.insert(oid, name.clone());
676670
Ok(name)

0 commit comments

Comments
 (0)