Skip to content

Commit 8acf9eb

Browse files
committed
refactor(clippy): fix warnings
1 parent 35ca858 commit 8acf9eb

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

tox_core/src/dht/kbucket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ where
226226
"No free space left in the kbucket, the last bad node removed.");
227227
// replace the farthest bad node
228228
self.nodes.remove(eviction_index);
229-
let index = index - if eviction_index < index { 1 } else { 0 };
229+
let index = index - usize::from(eviction_index < index);
230230
self.nodes.insert(index, new_node.into());
231231
true
232232
} else {
@@ -251,7 +251,7 @@ where
251251
"No free space left in the kbucket, the last (bad) node removed.");
252252
let eviction_index = Node::eviction_index(&self.nodes).unwrap_or(self.nodes.len() - 1);
253253
self.nodes.remove(eviction_index);
254-
let index = index - if eviction_index < index { 1 } else { 0 };
254+
let index = index - usize::from(eviction_index < index);
255255
self.nodes.insert(index, new_node.into());
256256
} else {
257257
self.nodes.insert(index, new_node.into());

tox_core/src/dht/server/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,10 @@ impl Server {
870870
if state.check_ping_id(payload.id, &packet.pk) {
871871
trace!("Received nodes with NodesResponse from {}: {:?}", addr, payload.nodes);
872872

873-
self.try_add_to_close(&mut *state, payload.id, PackedNode::new(addr, packet.pk.clone()), false).await?;
873+
self.try_add_to_close(&mut state, payload.id, PackedNode::new(addr, packet.pk.clone()), false).await?;
874874

875875
// Process nodes from NodesResponse
876-
self.add_bootstrap_nodes(&mut *state, &payload.nodes, &packet.pk).await;
876+
self.add_bootstrap_nodes(&mut state, &payload.nodes, &packet.pk).await;
877877
} else {
878878
// Some old version toxcore responds with wrong ping_id.
879879
// So we do not treat this as our own error.

tox_core/src/net_crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl NetCrypto {
280280
/// or disconnected.
281281
async fn send_connection_status(&self, connection: &CryptoConnection, status: bool) -> Result<(), mpsc::SendError> {
282282
if connection.is_established() != status {
283-
let tx = (&*self.connection_status_tx.read().await).clone();
283+
let tx = (*self.connection_status_tx.read().await).clone();
284284
maybe_send_unbounded(tx, (connection.peer_real_pk.clone(), status)).await
285285
} else {
286286
Ok(())

tox_core/src/onion/onion_announce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl OnionPingData {
155155
let mut buf = [0; ONION_PING_DATA_SIZE];
156156
// can not fail since buf has enough length
157157
self.to_bytes((&mut buf, 0)).unwrap();
158-
Sha256::digest(&buf).into()
158+
Sha256::digest(buf).into()
159159
}
160160
}
161161

tox_core/src/relay/client/connections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl Connections {
217217
if let Some(connection) = connections.get(&node_pk) {
218218
let clients = self.clients.read().await;
219219

220-
for c in connection.clients(&*clients) {
220+
for c in connection.clients(&clients) {
221221
let res = c.send_data(node_pk.clone(), data.clone()).await;
222222

223223
if res.is_ok() { break }

tox_node/src/node_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn app() -> Command {
234234
.help("Node to perform initial bootstrap")
235235
.num_args(2)
236236
.action(clap::ArgAction::Append)
237-
.value_names(&["public key", "address"]))
237+
.value_names(["public key", "address"]))
238238
.group(ArgGroup::new("req_flags")
239239
.args(["bootstrap-node", "tcp-address"])
240240
.multiple(true))

0 commit comments

Comments
 (0)