Skip to content

Commit a1acc98

Browse files
committed
More cleanup
1 parent 79ba9a0 commit a1acc98

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ fn initialize_stream(host: &str, port: Port, ssl: &SslMode)
335335
};
336336

337337
let (ssl_required, ctx) = match *ssl {
338-
NoSsl => return Ok(Normal(socket)),
338+
NoSsl => return Ok(NormalStream(socket)),
339339
PreferSsl(ref ctx) => (false, ctx),
340340
RequireSsl(ref ctx) => (true, ctx)
341341
};
@@ -347,42 +347,42 @@ fn initialize_stream(host: &str, port: Port, ssl: &SslMode)
347347
if ssl_required {
348348
return Err(NoSslSupport);
349349
} else {
350-
return Ok(Normal(socket));
350+
return Ok(NormalStream(socket));
351351
}
352352
}
353353

354354
match SslStream::try_new(ctx, socket) {
355-
Ok(stream) => Ok(Ssl(stream)),
355+
Ok(stream) => Ok(SslStream(stream)),
356356
Err(err) => Err(SslError(err))
357357
}
358358
}
359359

360360
enum InternalStream {
361-
Normal(TcpStream),
362-
Ssl(SslStream<TcpStream>)
361+
NormalStream(TcpStream),
362+
SslStream(SslStream<TcpStream>)
363363
}
364364

365365
impl Reader for InternalStream {
366366
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
367367
match *self {
368-
Normal(ref mut s) => s.read(buf),
369-
Ssl(ref mut s) => s.read(buf)
368+
NormalStream(ref mut s) => s.read(buf),
369+
SslStream(ref mut s) => s.read(buf)
370370
}
371371
}
372372
}
373373

374374
impl Writer for InternalStream {
375375
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
376376
match *self {
377-
Normal(ref mut s) => s.write(buf),
378-
Ssl(ref mut s) => s.write(buf)
377+
NormalStream(ref mut s) => s.write(buf),
378+
SslStream(ref mut s) => s.write(buf)
379379
}
380380
}
381381

382382
fn flush(&mut self) -> IoResult<()> {
383383
match *self {
384-
Normal(ref mut s) => s.flush(),
385-
Ssl(ref mut s) => s.flush()
384+
NormalStream(ref mut s) => s.flush(),
385+
SslStream(ref mut s) => s.flush()
386386
}
387387
}
388388
}
@@ -563,7 +563,7 @@ impl InnerPostgresConnection {
563563

564564
fn prepare<'a>(&mut self, query: &str, conn: &'a PostgresConnection)
565565
-> PostgresResult<PostgresStatement<'a>> {
566-
let stmt_name = format!("statement_{}", self.next_stmt_id);
566+
let stmt_name = format!("s{}", self.next_stmt_id);
567567
self.next_stmt_id += 1;
568568

569569
try_pg!(self.write_messages([
@@ -847,7 +847,7 @@ impl PostgresConnection {
847847
}
848848

849849
fn canary(&self) -> u32 {
850-
self.conn.borrow_mut().canary()
850+
self.conn.borrow().canary()
851851
}
852852

853853
fn quick_query(&self, query: &str)
@@ -1088,7 +1088,7 @@ impl<'conn> PostgresStatement<'conn> {
10881088
-> PostgresResult<PostgresRows<'a>> {
10891089
let id = self.next_portal_id.get();
10901090
self.next_portal_id.set(id + 1);
1091-
let portal_name = format!("{}_portal_{}", self.name, id);
1091+
let portal_name = format!("{}p{}", self.name, id);
10921092

10931093
try!(self.inner_execute(portal_name, row_limit, params));
10941094

0 commit comments

Comments
 (0)