Skip to content

Commit 39777f6

Browse files
committed
lint fixups
1 parent 374e0b4 commit 39777f6

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

network/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async-trait = { workspace = true }
3636
axum = { workspace = true }
3737
bcs = { workspace = true }
3838
bytes = { workspace = true }
39-
dashmap = {worksapce = true }
39+
dashmap = { worksapce = true }
4040
futures = { workspace = true }
4141
futures-util = { workspace = true }
4242
hex = { workspace = true }

network/builder/src/builder.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ use aptos_event_notifications::{EventSubscriptionService, ReconfigNotificationLi
2323
use aptos_infallible::RwLock;
2424
use aptos_logger::prelude::*;
2525
use aptos_netcore::transport::tcp::TCPBufferCfg;
26-
use aptos_network::application::netperf::builder::NetPerfBuilder;
2726
use aptos_network::{
28-
application::netperf::NetPerf,
29-
application::storage::PeerMetadataStorage,
27+
application::{
28+
netperf::{builder::NetPerfBuilder, NetPerf},
29+
storage::PeerMetadataStorage,
30+
},
3031
connectivity_manager::{builder::ConnectivityManagerBuilder, ConnectivityRequest},
3132
constants::MAX_MESSAGE_SIZE,
3233
logging::NetworkSchema,
@@ -446,7 +447,8 @@ impl NetworkBuilder {
446447

447448
/// Add a Aptos NetPerf to the network.
448449
fn add_network_perf(&mut self, netperf_port: u16) -> &mut Self {
449-
let (netperf_tx, netperf_rx) = self.add_client_and_service(&NetPerf::network_endpoint_config());
450+
let (netperf_tx, netperf_rx) =
451+
self.add_client_and_service(&NetPerf::network_endpoint_config());
450452
self.netperf_builder = Some(NetPerfBuilder::new(
451453
self.network_context(),
452454
self.peer_metadata_storage.clone(),

network/src/application/netperf/builder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Copyright (c) Aptos
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use crate::{
5-
application::netperf::{
4+
use crate::application::{
5+
netperf::{
66
interface::{NetPerfNetworkEvents, NetPerfNetworkSender},
77
NetPerf,
88
},
9-
application::storage::PeerMetadataStorage,
9+
storage::PeerMetadataStorage,
1010
};
1111
use aptos_config::network_id::NetworkContext;
1212
use aptos_logger::prelude::*;

network/src/application/netperf/interface.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ pub struct NetPerfPayload {
1010
}
1111

1212
impl NetPerfPayload {
13-
pub fn new(len: usize) -> Self {
13+
pub fn new(mut len: usize) -> Self {
1414
let mut v = Vec::with_capacity(len);
15-
unsafe {
16-
v.set_len(len);
15+
while len > 0 {
16+
v.push(0);
17+
len -= 1;
1718
}
1819
NetPerfPayload { byte: v }
1920
}

network/src/application/netperf/mod.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
//! and simplify network-related performance profiling and debugging
88
//!
99
10-
use crate::application::netperf::interface::NetPerfMsg;
11-
use crate::application::storage::PeerMetadataStorage;
12-
use crate::protocols::network::NetworkApplicationConfig;
13-
use crate::transport::ConnectionMetadata;
1410
use crate::{
15-
application::netperf::interface::{NetPerfNetworkEvents, NetPerfNetworkSender, NetPerfPayload},
11+
application::{
12+
netperf::interface::{
13+
NetPerfMsg, NetPerfNetworkEvents, NetPerfNetworkSender, NetPerfPayload,
14+
},
15+
storage::PeerMetadataStorage,
16+
},
1617
constants::NETWORK_CHANNEL_SIZE,
1718
counters,
1819
logging::NetworkSchema,
19-
protocols::network::Event,
20+
protocols::network::{Event, NetworkApplicationConfig},
21+
transport::ConnectionMetadata,
2022
ProtocolId,
2123
};
2224
use aptos_channels::{aptos_channel, message_queues::QueueStyle};
@@ -34,9 +36,11 @@ use dashmap::DashMap;
3436
use futures::StreamExt;
3537
use futures_util::stream::FuturesUnordered;
3638
use serde::Serialize;
37-
use std::fs::OpenOptions;
38-
use std::sync::atomic::AtomicBool;
39-
use std::{sync::Arc, time::Duration};
39+
use std::{
40+
fs::OpenOptions,
41+
sync::{atomic::AtomicBool, Arc},
42+
time::Duration,
43+
};
4044
use tokio::sync::mpsc::{Receiver, Sender};
4145

4246
pub mod builder;

network/src/counters.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ pub static APTOS_NETWORK_DISCOVERY_NOTES: Lazy<IntGaugeVec> = Lazy::new(|| {
156156
});
157157

158158
pub static APTOS_NETWORK_RPC_MESSAGES: Lazy<IntCounterVec> = Lazy::new(|| {
159-
register_int_counter_vec!(
160-
"aptos_network_rpc_messages",
161-
"Number of RPC messages",
162-
&["role_type", "network_id", "peer_id", "type", "state"]
163-
)
159+
register_int_counter_vec!("aptos_network_rpc_messages", "Number of RPC messages", &[
160+
"role_type",
161+
"network_id",
162+
"peer_id",
163+
"type",
164+
"state"
165+
])
164166
.unwrap()
165167
});
166168

0 commit comments

Comments
 (0)