Skip to content

Commit 2a822eb

Browse files
committed
Use autoderef stuff for RefCell
1 parent 01e77a0 commit 2a822eb

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/lib.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ impl InnerPostgresConnection {
507507
payload: payload
508508
}),
509509
ParameterStatus { parameter, value } =>
510-
info!("Parameter {} = {}", parameter, value),
510+
debug!("Parameter {} = {}", parameter, value),
511511
val => return Ok(val)
512512
}
513513
}
@@ -742,8 +742,7 @@ impl PostgresConnection {
742742
/// Sets the notice handler for the connection, returning the old handler.
743743
pub fn set_notice_handler(&self, handler: ~PostgresNoticeHandler)
744744
-> ~PostgresNoticeHandler {
745-
let mut conn = self.conn.borrow_mut();
746-
conn.get().set_notice_handler(handler)
745+
self.conn.borrow_mut().set_notice_handler(handler)
747746
}
748747

749748
/// Returns an iterator over asynchronous notification messages.
@@ -776,7 +775,7 @@ impl PostgresConnection {
776775
/// };
777776
pub fn try_prepare<'a>(&'a self, query: &str)
778777
-> Result<NormalPostgresStatement<'a>, PostgresError> {
779-
self.conn.with_mut(|conn| conn.try_prepare(query, self))
778+
self.conn.borrow_mut().try_prepare(query, self)
780779
}
781780

782781
/// A convenience wrapper around `try_prepare`.
@@ -871,7 +870,7 @@ impl PostgresConnection {
871870
/// Used with the `cancel_query` function. The object returned can be used
872871
/// to cancel any query executed by the connection it was created from.
873872
pub fn cancel_data(&self) -> PostgresCancelData {
874-
self.conn.with(|conn| conn.cancel_data)
873+
self.conn.borrow().cancel_data
875874
}
876875

877876
/// Returns whether or not the stream has been desynchronized due to an
@@ -880,7 +879,7 @@ impl PostgresConnection {
880879
/// If this has occurred, all further queries will immediately return an
881880
/// error.
882881
pub fn is_desynchronized(&self) -> bool {
883-
self.conn.with(|conn| conn.is_desynchronized())
882+
self.conn.borrow().is_desynchronized()
884883
}
885884

886885
/// Consumes the connection, closing it.
@@ -889,27 +888,26 @@ impl PostgresConnection {
889888
/// `PostgresConnection` except that it returns any error encountered to
890889
/// the caller.
891890
pub fn finish(self) -> Result<(), PostgresError> {
892-
self.conn.with_mut(|conn| {
893-
conn.finished = true;
894-
conn.finish_inner()
895-
})
891+
let mut conn = self.conn.borrow_mut();
892+
conn.finished = true;
893+
conn.finish_inner()
896894
}
897895

898896
fn quick_query(&self, query: &str)
899897
-> Result<Vec<Vec<Option<~str>>>, PostgresError> {
900-
self.conn.with_mut(|conn| conn.quick_query(query))
898+
self.conn.borrow_mut().quick_query(query)
901899
}
902900

903901
fn wait_for_ready(&self) -> Result<(), PostgresError> {
904-
self.conn.with_mut(|conn| conn.wait_for_ready())
902+
self.conn.borrow_mut().wait_for_ready()
905903
}
906904

907905
fn read_message(&self) -> IoResult<BackendMessage> {
908-
self.conn.with_mut(|conn| conn.read_message())
906+
self.conn.borrow_mut().read_message()
909907
}
910908

911909
fn write_messages(&self, messages: &[FrontendMessage]) -> IoResult<()> {
912-
self.conn.with_mut(|conn| conn.write_messages(messages))
910+
self.conn.borrow_mut().write_messages(messages)
913911
}
914912
}
915913

0 commit comments

Comments
 (0)