Skip to content

Commit d7c6339

Browse files
committed
Cleanup
1 parent 705f9f9 commit d7c6339

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

src/io.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ impl Timeout for InternalStream {
7171
fn open_socket(params: &ConnectParams) -> Result<InternalStream, ConnectError> {
7272
let port = params.port.unwrap_or(DEFAULT_PORT);
7373
match params.target {
74-
ConnectTarget::Tcp(ref host) =>
75-
Ok(try!(TcpStream::connect((host[], port)).map(InternalStream::Tcp))),
74+
ConnectTarget::Tcp(ref host) => {
75+
Ok(try!(TcpStream::connect((&**host, port)).map(InternalStream::Tcp)))
76+
}
7677
ConnectTarget::Unix(ref path) => {
7778
let mut path = path.clone();
7879
path.push(format!(".s.PGSQL.{}", port));

src/lib.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,13 @@ impl InnerConnection {
521521
-> Result<(Vec<Type>, Vec<ResultDescription>)> {
522522
try!(self.write_messages(&[
523523
Parse {
524-
name: &*stmt_name,
524+
name: stmt_name,
525525
query: query,
526526
param_types: &[]
527527
},
528528
Describe {
529529
variant: b'S',
530-
name: &*stmt_name,
530+
name: stmt_name,
531531
},
532532
Sync]));
533533

@@ -542,7 +542,7 @@ impl InnerConnection {
542542

543543
let mut param_types: Vec<_> = match try!(self.read_message()) {
544544
ParameterDescription { types } => {
545-
types.iter().map(|ty| Type::from_oid(*ty)).collect()
545+
types.into_iter().map(Type::from_oid).collect()
546546
}
547547
_ => bad_response!(self),
548548
};
@@ -1033,8 +1033,7 @@ impl<'conn> Transaction<'conn> {
10331033
}
10341034

10351035
/// Like `Connection::prepare_copy_in`.
1036-
pub fn prepare_copy_in(&self, table: &str, cols: &[&str])
1037-
-> Result<CopyInStatement<'conn>> {
1036+
pub fn prepare_copy_in(&self, table: &str, cols: &[&str]) -> Result<CopyInStatement<'conn>> {
10381037
self.conn.conn.borrow_mut().prepare_copy_in(table, cols, self.conn)
10391038
}
10401039

@@ -1117,8 +1116,8 @@ impl<'conn> Transaction<'conn> {
11171116

11181117
/// Consumes the transaction, commiting or rolling it back as appropriate.
11191118
///
1120-
/// Functionally equivalent to the `Drop` implementation of
1121-
/// `Transaction` except that it returns any error to the caller.
1119+
/// Functionally equivalent to the `Drop` implementation of `Transaction`
1120+
/// except that it returns any error to the caller.
11221121
pub fn finish(mut self) -> Result<()> {
11231122
self.finished = true;
11241123
self.finish_inner()
@@ -1237,6 +1236,7 @@ impl<'conn> Statement<'conn> {
12371236
/// Ok(count) => println!("{} row(s) updated", count),
12381237
/// Err(err) => println!("Error executing query: {}", err)
12391238
/// }
1239+
/// ```
12401240
pub fn execute(&self, params: &[&ToSql]) -> Result<uint> {
12411241
check_desync!(self.conn);
12421242
try!(self.inner_execute("", 0, params));
@@ -1352,11 +1352,11 @@ impl<'stmt> Rows<'stmt> {
13521352
EmptyQueryResponse | CommandComplete { .. } => {
13531353
self.more_rows = false;
13541354
break;
1355-
},
1355+
}
13561356
PortalSuspended => {
13571357
self.more_rows = true;
13581358
break;
1359-
},
1359+
}
13601360
DataRow { row } => self.data.push_back(row),
13611361
ErrorResponse { fields } => {
13621362
try!(conn.wait_for_ready());
@@ -1440,7 +1440,6 @@ pub struct Row<'stmt> {
14401440

14411441
impl<'stmt> Row<'stmt> {
14421442
/// Returns the number of values in the row
1443-
#[inline]
14441443
pub fn len(&self) -> uint {
14451444
self.data.len()
14461445
}
@@ -1524,19 +1523,16 @@ pub struct LazyRows<'trans, 'stmt> {
15241523

15251524
impl<'trans, 'stmt> LazyRows<'trans, 'stmt> {
15261525
/// Like `Rows::finish`.
1527-
#[inline]
15281526
pub fn finish(self) -> Result<()> {
15291527
self.result.finish()
15301528
}
15311529
}
15321530

15331531
impl<'trans, 'stmt> Iterator<Result<Row<'stmt>>> for LazyRows<'trans, 'stmt> {
1534-
#[inline]
15351532
fn next(&mut self) -> Option<Result<Row<'stmt>>> {
15361533
self.result.try_next()
15371534
}
15381535

1539-
#[inline]
15401536
fn size_hint(&self) -> (uint, Option<uint>) {
15411537
self.result.size_hint()
15421538
}

src/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub trait ReadMessage {
276276
impl<R: Reader+Timeout> ReadMessage for R {
277277
fn read_message(&mut self) -> IoResult<BackendMessage> {
278278
// The first byte read is a bit complex to make
279-
// Notifications#next_block_for work.
279+
// Notifications::next_block_for work.
280280
let ident = self.read_u8();
281281
// At this point we've got to turn off any read timeout to prevent
282282
// stream desynchronization. We're assuming that if we've got the first

0 commit comments

Comments
 (0)