Skip to content

Commit 900ae55

Browse files
committed
Fix doc tests
1 parent 2160227 commit 900ae55

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! package.
44
//!
55
//! ```rust,no_run
6+
//! # #![allow(unstable)]
67
//! extern crate postgres;
78
//! extern crate time;
89
//!
@@ -273,6 +274,7 @@ impl<'conn> Notifications<'conn> {
273274
/// ## Example
274275
///
275276
/// ```rust,no_run
277+
/// # #![allow(unstable)]
276278
/// use std::io::{IoError, IoErrorKind};
277279
/// use std::time::Duration;
278280
///
@@ -284,7 +286,7 @@ impl<'conn> Notifications<'conn> {
284286
/// Err(Error::IoError(IoError { kind: IoErrorKind::TimedOut, .. })) => {
285287
/// println!("Wait for notification timed out");
286288
/// }
287-
/// Err(e) => println!("Other error: {}", e),
289+
/// Err(e) => println!("Other error: {:?}", e),
288290
/// }
289291
/// ```
290292
pub fn next_block_for(&mut self, timeout: Duration) -> Result<Notification> {
@@ -347,14 +349,15 @@ pub struct CancelData {
347349
/// ## Example
348350
///
349351
/// ```rust,no_run
352+
/// # #![allow(unstable)]
350353
/// # use postgres::{Connection, SslMode};
351354
/// # use std::thread::Thread;
352355
/// # let url = "";
353356
/// let conn = Connection::connect(url, &SslMode::None).unwrap();
354357
/// let cancel_data = conn.cancel_data();
355358
/// Thread::spawn(move || {
356359
/// conn.execute("SOME EXPENSIVE QUERY", &[]).unwrap();
357-
/// }).detach();
360+
/// });
358361
/// # let _ =
359362
/// postgres::cancel_query(url, &SslMode::None, cancel_data);
360363
/// ```
@@ -819,6 +822,7 @@ impl Connection {
819822
/// ```
820823
///
821824
/// ```rust,no_run
825+
/// # #![allow(unstable)]
822826
/// # use postgres::{Connection, UserInfo, ConnectParams, SslMode, ConnectTarget, ConnectError};
823827
/// # fn f() -> Result<(), ConnectError> {
824828
/// # let some_crazy_path = Path::new("");
@@ -871,7 +875,7 @@ impl Connection {
871875
/// let maybe_stmt = conn.prepare("SELECT foo FROM bar WHERE baz = $1");
872876
/// let stmt = match maybe_stmt {
873877
/// Ok(stmt) => stmt,
874-
/// Err(err) => panic!("Error preparing statement: {}", err)
878+
/// Err(err) => panic!("Error preparing statement: {:?}", err)
875879
/// };
876880
pub fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
877881
let mut conn = self.conn.borrow_mut();
@@ -1301,7 +1305,7 @@ impl<'conn> Statement<'conn> {
13011305
/// let stmt = conn.prepare("UPDATE foo SET bar = $1 WHERE baz = $2").unwrap();
13021306
/// match stmt.execute(&[&bar, &baz]) {
13031307
/// Ok(count) => println!("{} row(s) updated", count),
1304-
/// Err(err) => println!("Error executing query: {}", err)
1308+
/// Err(err) => println!("Error executing query: {:?}", err)
13051309
/// }
13061310
/// ```
13071311
pub fn execute(&self, params: &[&ToSql]) -> Result<usize> {
@@ -1355,7 +1359,7 @@ impl<'conn> Statement<'conn> {
13551359
/// # let baz = true;
13561360
/// let mut rows = match stmt.query(&[&baz]) {
13571361
/// Ok(rows) => rows,
1358-
/// Err(err) => panic!("Error running query: {}", err)
1362+
/// Err(err) => panic!("Error running query: {:?}", err)
13591363
/// };
13601364
/// for row in rows {
13611365
/// let foo: i32 = row.get("foo");

0 commit comments

Comments
 (0)