Skip to content

Commit 5fd3d70

Browse files
committed
Make use of deref coercions
1 parent 90f5567 commit 5fd3d70

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/lib.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl IntoConnectParams for Url {
172172
..
173173
} = self;
174174

175-
let maybe_path = try!(url::decode_component(&*host).map_err(ConnectError::InvalidUrl));
175+
let maybe_path = try!(url::decode_component(&host).map_err(ConnectError::InvalidUrl));
176176
let target = if maybe_path.starts_with("/") {
177177
ConnectTarget::Unix(Path::new(maybe_path))
178178
} else {
@@ -444,7 +444,7 @@ impl InnerConnection {
444444

445445
try!(conn.write_messages(&[StartupMessage {
446446
version: message::PROTOCOL_VERSION,
447-
parameters: &*options
447+
parameters: &options
448448
}]));
449449

450450
try!(conn.handle_auth(user));
@@ -545,7 +545,7 @@ impl InnerConnection {
545545
AuthenticationCleartextPassword => {
546546
let pass = try!(user.password.ok_or(ConnectError::MissingPassword));
547547
try!(self.write_messages(&[PasswordMessage {
548-
password: &*pass,
548+
password: &pass,
549549
}]));
550550
}
551551
AuthenticationMD5Password { salt } => {
@@ -559,7 +559,7 @@ impl InnerConnection {
559559
hasher.update(&salt);
560560
let output = format!("md5{}", hasher.finalize().to_hex());
561561
try!(self.write_messages(&[PasswordMessage {
562-
password: &*output
562+
password: &output
563563
}]));
564564
}
565565
AuthenticationKerberosV5
@@ -641,7 +641,7 @@ impl InnerConnection {
641641

642642
fn prepare<'a>(&mut self, query: &str, conn: &'a Connection) -> Result<Statement<'a>> {
643643
let stmt_name = self.make_stmt_name();
644-
let (param_types, result_desc) = try!(self.raw_prepare(&*stmt_name, query));
644+
let (param_types, result_desc) = try!(self.raw_prepare(&stmt_name, query));
645645
Ok(Statement {
646646
conn: conn,
647647
name: stmt_name,
@@ -659,7 +659,7 @@ impl InnerConnection {
659659
Some(stmt) => stmt,
660660
None => {
661661
let stmt_name = self.make_stmt_name();
662-
let (param_types, result_desc) = try!(self.raw_prepare(&*stmt_name, query));
662+
let (param_types, result_desc) = try!(self.raw_prepare(&stmt_name, query));
663663
let stmt = CachedStatement {
664664
name: stmt_name,
665665
param_types: param_types,
@@ -687,7 +687,7 @@ impl InnerConnection {
687687
let _ = util::comma_join(&mut query, rows.iter().cloned());
688688
let _ = write!(&mut query, " FROM {}", table);
689689
let query = String::from_utf8(query).unwrap();
690-
let (_, result_desc) = try!(self.raw_prepare("", &*query));
690+
let (_, result_desc) = try!(self.raw_prepare("", &query));
691691
let column_types = result_desc.into_iter().map(|desc| desc.ty).collect();
692692

693693
let mut query = vec![];
@@ -696,7 +696,7 @@ impl InnerConnection {
696696
let _ = write!(&mut query, ") FROM STDIN WITH (FORMAT binary)");
697697
let query = String::from_utf8(query).unwrap();
698698
let stmt_name = self.make_stmt_name();
699-
try!(self.raw_prepare(&*stmt_name, &*query));
699+
try!(self.raw_prepare(&stmt_name, &query));
700700

701701
Ok(CopyInStatement {
702702
conn: conn,
@@ -819,7 +819,7 @@ impl InnerConnection {
819819
ReadyForQuery { .. } => break,
820820
DataRow { row } => {
821821
result.push(row.into_iter().map(|opt| {
822-
opt.map(|b| String::from_utf8_lossy(&*b).into_owned())
822+
opt.map(|b| String::from_utf8_lossy(&b).into_owned())
823823
}).collect());
824824
}
825825
CopyInResponse { .. } => {
@@ -1313,7 +1313,7 @@ impl<'conn> Statement<'conn> {
13131313
self.finished = true;
13141314
let mut conn = self.conn.conn.borrow_mut();
13151315
check_desync!(conn);
1316-
conn.close_statement(&*self.name, b'S')
1316+
conn.close_statement(&self.name, b'S')
13171317
} else {
13181318
Ok(())
13191319
}
@@ -1335,9 +1335,9 @@ impl<'conn> Statement<'conn> {
13351335
try!(conn.write_messages(&[
13361336
Bind {
13371337
portal: portal_name,
1338-
statement: &*self.name,
1338+
statement: &self.name,
13391339
formats: &[1],
1340-
values: &*values,
1340+
values: &values,
13411341
result_formats: &[1]
13421342
},
13431343
Execute {
@@ -1374,12 +1374,12 @@ impl<'conn> Statement<'conn> {
13741374

13751375
/// Returns a slice containing the expected parameter types.
13761376
pub fn param_types(&self) -> &[Type] {
1377-
&*self.param_types
1377+
&self.param_types
13781378
}
13791379

13801380
/// Returns a slice describing the columns of the result of the query.
13811381
pub fn result_descriptions(&self) -> &[ResultDescription] {
1382-
&*self.result_desc
1382+
&self.result_desc
13831383
}
13841384

13851385
/// Executes the prepared statement, returning the number of rows modified.
@@ -1492,7 +1492,7 @@ impl<'conn> Statement<'conn> {
14921492
self.next_portal_id.set(id + 1);
14931493
let portal_name = format!("{}p{}", self.name, id);
14941494

1495-
self.inner_query(&*portal_name, row_limit, params).map(move |(result, more_rows)| {
1495+
self.inner_query(&portal_name, row_limit, params).map(move |(result, more_rows)| {
14961496
LazyRows {
14971497
_trans: trans,
14981498
result: result,
@@ -1724,13 +1724,13 @@ impl<'trans, 'stmt> LazyRows<'trans, 'stmt> {
17241724
fn finish_inner(&mut self) -> Result<()> {
17251725
let mut conn = self.result.stmt.conn.conn.borrow_mut();
17261726
check_desync!(conn);
1727-
conn.close_statement(&*self.name, b'P')
1727+
conn.close_statement(&self.name, b'P')
17281728
}
17291729

17301730
fn execute(&mut self) -> Result<()> {
17311731
try!(self.result.stmt.conn.write_messages(&[
17321732
Execute {
1733-
portal: &*self.name,
1733+
portal: &self.name,
17341734
max_rows: self.row_limit
17351735
},
17361736
Sync]));
@@ -1845,12 +1845,12 @@ impl<'a> CopyInStatement<'a> {
18451845
fn finish_inner(&mut self) -> Result<()> {
18461846
let mut conn = self.conn.conn.borrow_mut();
18471847
check_desync!(conn);
1848-
conn.close_statement(&*self.name, b'S')
1848+
conn.close_statement(&self.name, b'S')
18491849
}
18501850

18511851
/// Returns a slice containing the expected column types.
18521852
pub fn column_types(&self) -> &[Type] {
1853-
&*self.column_types
1853+
&self.column_types
18541854
}
18551855

18561856
/// Executes the prepared statement.
@@ -1868,7 +1868,7 @@ impl<'a> CopyInStatement<'a> {
18681868
try!(conn.write_messages(&[
18691869
Bind {
18701870
portal: "",
1871-
statement: &*self.name,
1871+
statement: &self.name,
18721872
formats: &[],
18731873
values: &[],
18741874
result_formats: &[]
@@ -1917,13 +1917,13 @@ impl<'a> CopyInStatement<'a> {
19171917
}
19181918
Ok(Some(val)) => {
19191919
let _ = buf.write_be_i32(val.len() as i32);
1920-
let _ = buf.write_all(&*val);
1920+
let _ = buf.write_all(&val);
19211921
}
19221922
Err(err) => {
19231923
// FIXME this is not the right way to handle this
19241924
try_desync!(conn, conn.stream.write_message(
19251925
&CopyFail {
1926-
message: &*err.to_string(),
1926+
message: &err.to_string(),
19271927
}));
19281928
break 'l;
19291929
}
@@ -1942,15 +1942,15 @@ impl<'a> CopyInStatement<'a> {
19421942

19431943
try_desync!(conn, conn.stream.write_message(
19441944
&CopyData {
1945-
data: &*buf
1945+
data: &buf
19461946
}));
19471947
buf.clear();
19481948
}
19491949

19501950
let _ = buf.write_be_i16(-1);
19511951
try!(conn.write_messages(&[
19521952
CopyData {
1953-
data: &*buf,
1953+
data: &buf,
19541954
},
19551955
CopyDone,
19561956
Sync]));

0 commit comments

Comments
 (0)