Skip to content

Commit b07cd3a

Browse files
committed
fix to apply cargo fmt and cargo clippy to pass the the repo checks
1 parent baa8a49 commit b07cd3a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/servers/src/actix_web.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use actix_web::web::{Bytes, Data, Payload, Query};
2-
use actix_web::{
3-
get, post, App, Error, HttpResponse, HttpServer, Result,
4-
};
2+
use actix_web::{get, post, App, Error, HttpResponse, HttpServer, Result};
53
use futures::{StreamExt, TryStreamExt};
64
use mcp_server::{ByteTransport, Server};
75
use std::collections::HashMap;
@@ -15,7 +13,6 @@ use tokio::{
1513
io::{self, AsyncWriteExt},
1614
sync::Mutex,
1715
};
18-
use tracing_subscriber;
1916
mod common;
2017
use common::counter;
2118

@@ -76,12 +73,12 @@ async fn post_event_handler(
7673
return Ok(HttpResponse::PayloadTooLarge().finish());
7774
}
7875

79-
if let Err(_) = write_stream.write_all(&chunk).await {
76+
if (write_stream.write_all(&chunk).await).is_err() {
8077
return Ok(HttpResponse::InternalServerError().finish());
8178
}
8279
}
8380

84-
if let Err(_) = write_stream.write_u8(b'\n').await {
81+
if (write_stream.write_u8(b'\n').await).is_err() {
8582
return Ok(HttpResponse::InternalServerError().finish());
8683
}
8784

@@ -130,7 +127,7 @@ async fn sse_handler(app_state: Data<AppState>) -> Result<HttpResponse, Error> {
130127
.map_ok(move |bytes| {
131128
let message = match std::str::from_utf8(&bytes) {
132129
Ok(message) => format!("event: message\ndata: {}\n\n", message),
133-
Err(_) => format!("event: error\ndata: Invalid UTF-8 data\n\n"),
130+
Err(_) => "event: error\ndata: Invalid UTF-8 data\n\n".to_string(),
134131
};
135132
Bytes::from(message)
136133
}),

0 commit comments

Comments
 (0)