Skip to content

Commit b853900

Browse files
committed
Improve examples a bit
1 parent 699a3f1 commit b853900

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,7 @@ impl InnerPostgresConnection {
438438
Ok(conn)
439439
}
440440

441-
fn write_messages(&mut self, messages: &[FrontendMessage])
442-
-> IoResult<()> {
441+
fn write_messages(&mut self, messages: &[FrontendMessage]) -> IoResult<()> {
443442
debug_assert!(!self.desynchronized);
444443
for message in messages.iter() {
445444
try_desync!(self, self.stream.write_message(message));
@@ -627,8 +626,7 @@ impl InnerPostgresConnection {
627626
}
628627
}
629628

630-
fn quick_query(&mut self, query: &str)
631-
-> PostgresResult<Vec<Vec<Option<String>>>> {
629+
fn quick_query(&mut self, query: &str) -> PostgresResult<Vec<Vec<Option<String>>>> {
632630
check_desync!(self);
633631
try_pg!(self.write_messages([Query { query: query }]));
634632

@@ -688,22 +686,23 @@ impl PostgresConnection {
688686
///
689687
/// ```rust,no_run
690688
/// # use postgres::{PostgresConnection, NoSsl};
689+
/// # let _ = || {
691690
/// let url = "postgresql://postgres:hunter2@localhost:2994/foodb";
692-
/// let maybe_conn = PostgresConnection::connect(url, &NoSsl);
693-
/// let conn = match maybe_conn {
694-
/// Ok(conn) => conn,
695-
/// Err(err) => fail!("Error connecting: {}", err)
696-
/// };
691+
/// let conn = try!(PostgresConnection::connect(url, &NoSsl));
692+
/// # Ok(()) };
697693
/// ```
698694
///
699695
/// ```rust,no_run
700696
/// # use postgres::{PostgresConnection, NoSsl};
697+
/// # let _ = || {
701698
/// let url = "postgresql://postgres@%2Frun%2Fpostgres";
702-
/// let maybe_conn = PostgresConnection::connect(url, &NoSsl);
699+
/// let conn = try!(PostgresConnection::connect(url, &NoSsl));
700+
/// # Ok(()) };
703701
/// ```
704702
///
705703
/// ```rust,no_run
706704
/// # use postgres::{PostgresConnection, PostgresUserInfo, PostgresConnectParams, NoSsl, TargetUnix};
705+
/// # let _ = || {
707706
/// # let some_crazy_path = Path::new("");
708707
/// let params = PostgresConnectParams {
709708
/// target: TargetUnix(some_crazy_path),
@@ -715,7 +714,8 @@ impl PostgresConnection {
715714
/// database: None,
716715
/// options: vec![],
717716
/// };
718-
/// let maybe_conn = PostgresConnection::connect(params, &NoSsl);
717+
/// let conn = try!(PostgresConnection::connect(params, &NoSsl));
718+
/// # Ok(()) };
719719
/// ```
720720
pub fn connect<T>(params: T, ssl: &SslMode) -> Result<PostgresConnection, PostgresConnectError>
721721
where T: IntoConnectParams {

0 commit comments

Comments
 (0)