Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit f94deba

Browse files
committed
Fix needless_borrow warnings
Signed-off-by: Joseph Livesey <joseph.livesey@btp.works>
1 parent 1b0b130 commit f94deba

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

families/battleship/src/bin/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn run() -> Result<(), Error> {
154154
let col = fire_matches.value_of("col").expect("Column is required!");
155155
let wait = parse_wait_flag(fire_matches)?;
156156

157-
let game = client.get_game(&name)?;
157+
let game = client.get_game(name)?;
158158
let board = Board::load_or_generate(format!("{}-{}", name, key), &game.ships)?;
159159
let (reveal_space, reveal_nonce) = game.get_last_fire_row_col(&board)?;
160160

families/battleship/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> BattleshipClient<'a> {
8686
let mut contents = String::new();
8787
file.read_to_string(&mut contents)?;
8888
Box::new(
89-
Secp256k1PrivateKey::from_hex(&contents.trim())
89+
Secp256k1PrivateKey::from_hex(contents.trim())
9090
.map_err(|e| format_err!("{}", e))?,
9191
)
9292
};

families/battleship/src/game.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl Board {
332332
pub fn render(&self) -> String {
333333
self.spaces
334334
.iter()
335-
.map(|ref row| row.iter().collect::<String>())
335+
.map(|row| row.iter().collect::<String>())
336336
.collect::<Vec<_>>()
337337
.join("\n")
338338
}

families/battleship/src/handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ impl BattleshipTransactionHandler {
248248
// Every turn after the first should hit this, unless the client tried giving
249249
// incomplete information.
250250
(Some(lfc), Some(lfr), Some(rs), Some(rn)) => {
251-
let last_row = game::parse_row(&lfr).ok_or_else(|| {
251+
let last_row = game::parse_row(lfr).ok_or_else(|| {
252252
ApplyError::InvalidTransaction(format!("Invalid row {}", row))
253253
})?;
254254

255-
let last_col = game::parse_column(&lfc).ok_or_else(|| {
255+
let last_col = game::parse_column(lfc).ok_or_else(|| {
256256
ApplyError::InvalidTransaction(format!("Invalid column {}", column))
257257
})?;
258258

259-
let space_hash = game::get_space_hash(rs, &rn);
259+
let space_hash = game::get_space_hash(rs, rn);
260260

261261
let hashed_board = match game.state.as_ref() {
262262
"P1-NEXT" => &game.hashed_board_1,

families/block_info/sawtooth_block_info/src/payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct BlockInfoPayload {
4040

4141
impl BlockInfoPayload {
4242
pub fn new(payload_data: &[u8]) -> Result<BlockInfoPayload, ApplyError> {
43-
let payload: BlockInfoTxn = parse_protobuf(&payload_data)?;
43+
let payload: BlockInfoTxn = parse_protobuf(payload_data)?;
4444

4545
{
4646
let next_block = payload.get_block();

families/settings/sawtooth_settings/src/handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ impl TransactionHandler for SettingsTransactionHandler {
116116
match settings_payload.get_action() {
117117
SettingsPayload_Action::PROPOSE => apply_proposal(
118118
&auth_keys,
119-
&public_key,
119+
public_key,
120120
settings_payload.get_data(),
121121
context,
122122
),
123123
SettingsPayload_Action::VOTE => apply_vote(
124124
&auth_keys,
125-
&public_key,
125+
public_key,
126126
settings_payload.get_data(),
127127
context,
128128
),
@@ -255,7 +255,7 @@ fn unpack_data<T>(data: &[u8]) -> Result<T, ApplyError>
255255
where
256256
T: protobuf::Message,
257257
{
258-
Message::parse_from_bytes(&data).map_err(|err| {
258+
Message::parse_from_bytes(data).map_err(|err| {
259259
warn!(
260260
"Invalid error: Failed to unmarshal SettingsTransaction: {:?}",
261261
err

families/smallbank/smallbank_rust/src/handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl TransactionHandler for SmallbankTransactionHandler {
102102
}
103103

104104
fn unpack_payload(payload: &[u8]) -> Result<SmallbankTransactionPayload, ApplyError> {
105-
Message::parse_from_bytes(&payload).map_err(|err| {
105+
Message::parse_from_bytes(payload).map_err(|err| {
106106
warn!(
107107
"Invalid transaction: Failed to unmarshal SmallbankTransaction: {:?}",
108108
err
@@ -260,7 +260,7 @@ fn apply_amalgamate(
260260
}
261261

262262
fn unpack_account(account_data: &[u8]) -> Result<Account, ApplyError> {
263-
Message::parse_from_bytes(&account_data).map_err(|err| {
263+
Message::parse_from_bytes(account_data).map_err(|err| {
264264
warn!(
265265
"Invalid transaction: Failed to unmarshal Account: {:?}",
266266
err

perf/intkey_workload/src/intkey_transformer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'a> IntKeyTransformer<'a> {
103103
.collect(),
104104
);
105105

106-
let payload_bytes = self.payload_to_cbor_bytes(&payload)?;
106+
let payload_bytes = self.payload_to_cbor_bytes(payload)?;
107107

108108
let mut sha = Sha512::new();
109109
sha.input(payload_bytes.as_slice());

perf/sawtooth_perf/src/workload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub fn form_request_from_batchlist(
234234

235235
if let Some(ref basic_auth) = *basic_auth {
236236
req.headers_mut()
237-
.set(Authorization(Basic::from_str(&basic_auth)?));
237+
.set(Authorization(Basic::from_str(basic_auth)?));
238238
}
239239

240240
Ok((req, batch_id))

perf/smallbank_workload/src/smallbank_transformer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ impl<'a> SBPayloadTransformer<'a> {
105105
let elapsed = Instant::now().elapsed();
106106
txn_header.set_nonce(format!("{}{}", elapsed.as_secs(), elapsed.subsec_nanos()));
107107

108-
let addresses = protobuf::RepeatedField::from_vec(make_addresses(&payload));
108+
let addresses = protobuf::RepeatedField::from_vec(make_addresses(payload));
109109

110110
txn_header.set_inputs(addresses.clone());
111111
txn_header.set_outputs(addresses);
112112

113-
let dependencies = protobuf::RepeatedField::from_vec(self.get_dependencies(&payload));
113+
let dependencies = protobuf::RepeatedField::from_vec(self.get_dependencies(payload));
114114
txn_header.set_dependencies(dependencies);
115115

116116
let payload_bytes = payload.clone().write_to_bytes()?;
@@ -127,7 +127,7 @@ impl<'a> SBPayloadTransformer<'a> {
127127
let header_bytes = txn_header.write_to_bytes()?;
128128

129129
let signature = self.signer.sign(&header_bytes.to_vec())?;
130-
self.add_signature_if_create_account(&payload, signature.clone());
130+
self.add_signature_if_create_account(payload, signature.clone());
131131

132132
txn.set_header(header_bytes);
133133
txn.set_header_signature(signature);

0 commit comments

Comments
 (0)