Skip to content

Commit c6a6eed

Browse files
chore(common): remove unused code and suppress warnings
- Prefixed unused guest server function with underscore to prevent dead code warning - Cleaned up commented code and clarified comments - No functional changes, only warning suppression and code hygiene
1 parent 37076b4 commit c6a6eed

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

src/agent/nodeagent/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ version = "0.1.0"
44
edition = "2021"
55
license = "Apache-2.0"
66

7+
[features]
8+
tarpaulin_include = []
9+
710
[dependencies]
811
common = { workspace = true }
912
tonic = "0.12.3"

src/agent/nodeagent/src/grpc/sender.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use common::apiserver::api_server_connection_client::ApiServerConnectionClient;
77
use common::monitoringserver::{
8-
ContainerList, NodeInfo, SendContainerListResponse, SendNodeInfoResponse,
8+
ContainerList, SendContainerListResponse,
99
};
1010
use common::nodeagent::{
1111
HeartbeatRequest, HeartbeatResponse, NodeRegistrationRequest, NodeRegistrationResponse,
@@ -37,10 +37,10 @@ impl NodeAgentSender {
3737
}
3838
Err(e) => {
3939
// Handle connection error
40-
return Err(Status::unknown(format!(
40+
Err(Status::unknown(format!(
4141
"Failed to connect statemanager: {}",
4242
e
43-
)));
43+
)))
4444
}
4545
}
4646
}

src/agent/nodeagent/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ async fn initialize(tx_grpc: Sender<HandleYamlRequest>, hostname: String, config
117117

118118
// Use hostname from config if available
119119
let config_hostname = config.get_hostname();
120-
let hostname_to_check = if config_hostname.is_empty() || config_hostname == "$(hostname)" {
120+
//adding _ to prevent warnings as it was never used anywhere to prevent warnings
121+
let _hostname_to_check = if config_hostname.is_empty() || config_hostname == "$(hostname)" {
121122
hostname.clone()
122123
} else {
123124
config_hostname
@@ -151,7 +152,7 @@ struct Args {
151152
config: PathBuf,
152153
}
153154

154-
#[cfg(not(tarpaulin_include))]
155+
#[cfg(not(feature = "tarpaulin_include"))]
155156
#[tokio::main]
156157
async fn main() {
157158
// Parse command line arguments

src/common/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
77
tonic_build::configure()
88
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
99
.protoc_arg("--experimental_allow_proto3_optional")
10-
.compile(
10+
.compile_protos(
1111
&[
1212
"proto/apiserver.proto",
1313
"proto/actioncontroller.proto",

src/common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ fn connect_server(port: u16) -> String {
2424
}
2525

2626
// guest 서버 연결 함수 수정: 이제 항상 호스트 서버 주소 반환
27-
fn connect_guest_server(port: u16) -> String {
27+
//using rust build in _ to below code , as it was never used anywhere to prevent warnings
28+
fn _connect_guest_server(port: u16) -> String {
2829
// 항상 호스트 서버 주소 반환
2930
connect_server(port)
3031
}

src/common/src/spec/k8s/pod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl PodSpec {
9898
/// If no containers are present, returns `None`.
9999
pub fn get_image(&self) -> Option<&str> {
100100
self.containers
101-
.get(0)
101+
.first()
102102
.map(|container| container.image.as_str())
103103
}
104104

0 commit comments

Comments
 (0)