Skip to content

Commit 82adaf5

Browse files
fix for cargo clippy --all-targets --all-features
1 parent d2bab42 commit 82adaf5

File tree

9 files changed

+17
-18
lines changed

9 files changed

+17
-18
lines changed

src/server/apiserver/src/artifact/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub async fn withdraw(body: &str) -> common::Result<String> {
153153
#[cfg(test)]
154154
mod tests {
155155
use super::*;
156-
use tokio;
156+
157157

158158
// -- Test Artifacts --
159159

src/server/apiserver/src/grpc/receiver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ mod tests {
413413
assert!(result.is_ok());
414414

415415
let response = result.unwrap().into_inner();
416-
assert_eq!(response.success, false);
416+
assert!(!response.success);
417417
assert!(
418418
response.message.contains("not found")
419419
|| response.message.contains("Failed to retrieve node")
@@ -494,7 +494,7 @@ mod tests {
494494
assert!(result.is_ok());
495495

496496
let response = result.unwrap().into_inner();
497-
assert_eq!(response.success, true);
497+
assert!(response.success);
498498
assert_eq!(response.message, "Successfully updated topology");
499499
assert!(response.updated_topology.is_some());
500500

@@ -512,7 +512,7 @@ mod tests {
512512
assert!(result.is_ok());
513513

514514
let response = result.unwrap().into_inner();
515-
assert_eq!(response.success, false);
515+
assert!(!response.success);
516516
assert_eq!(response.message, "No topology provided in request");
517517
assert!(response.updated_topology.is_none());
518518
}

src/server/apiserver/src/grpc/sender/filtergateway.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ spec:
133133
tokio::spawn(async move {
134134
tonic::transport::Server::builder()
135135
.add_service(FilterGatewayConnectionServer::new(
136-
MockFilterGateway::default(),
136+
MockFilterGateway,
137137
))
138138
.serve_with_incoming(stream)
139139
.await

src/server/apiserver/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ mod node;
2121
mod route;
2222

2323
/// Main function of Piccolo API Server
24+
#[cfg(feature = "tarpaulin_include")]
25+
fn main() {
26+
// Dummy main for coverage builds
27+
println!("Tarpaulin coverage build: main function stub.");
28+
}
2429
#[cfg(not(feature = "tarpaulin_include"))]
2530
#[tokio::main]
2631
async fn main() {

src/server/apiserver/src/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ spec:
748748
tokio::spawn(async move {
749749
tonic::transport::Server::builder()
750750
.add_service(FilterGatewayConnectionServer::new(
751-
MockFilterGateway::default(),
751+
MockFilterGateway,
752752
))
753753
.serve_with_incoming(stream)
754754
.await

src/server/apiserver/src/route/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async fn withdraw_artifact(body: String) -> Response {
5555
//UNIT TEST CASES
5656
#[cfg(test)]
5757
mod tests {
58-
use super::*;
58+
5959
use crate::route::status;
6060
use axum::{
6161
body::Body,

src/server/apiserver/src/route/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ mod tests {
5858
routing::{delete, get, post},
5959
Router,
6060
};
61-
use std::{error::Error as StdError, net::SocketAddr};
62-
use tokio::{
63-
net::{TcpListener, TcpStream},
64-
task,
65-
time::{sleep, Duration},
66-
};
61+
use std::error::Error as StdError;
62+
6763
use tower::ServiceExt;
6864
use tower_http::cors::{Any, CorsLayer};
6965

@@ -75,7 +71,7 @@ mod tests {
7571
assert_eq!(ok_response.status(), StatusCode::OK);
7672

7773
// Negative case: Error response
78-
let err = Box::new(std::io::Error::new(std::io::ErrorKind::Other, "test error"))
74+
let err = Box::new(std::io::Error::other("test error"))
7975
as Box<dyn StdError + Send + Sync>;
8076
let err_response = status(Err(err));
8177
assert_eq!(err_response.status(), StatusCode::METHOD_NOT_ALLOWED);

src/server/apiserver/tests/apiserver_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use apiserver::manager;
2-
use tokio::time::{timeout, Duration};
2+
use tokio::time::Duration;
33

44
#[tokio::test(flavor = "current_thread")]
55
async fn test_manager_initialize() {

src/server/apiserver/tests/manager_integration.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use apiserver::manager::{apply_artifact, initialize, withdraw_artifact};
2-
use common::filtergateway::{Action, HandleScenarioRequest};
3-
use tokio;
1+
use apiserver::manager::{apply_artifact, initialize};
42

53
/// Correct valid YAML artifact (Scenario + Package + Model)
64
const VALID_ARTIFACT_YAML: &str = r#"

0 commit comments

Comments
 (0)