Skip to content

Commit 1ec72e8

Browse files
committed
fix clippy warnings
1 parent 05dccdf commit 1ec72e8

9 files changed

Lines changed: 17 additions & 12 deletions

File tree

src/api/stow/service.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ pub enum StoreError {
102102
impl IntoResponse for StoreError {
103103
fn into_response(self) -> axum::response::Response {
104104
match self {
105-
StoreError::UploadLimitExceeded => Response::builder()
105+
Self::UploadLimitExceeded => Response::builder()
106106
.status(StatusCode::PAYLOAD_TOO_LARGE)
107107
.body(Body::from("Upload limit exceeded"))
108108
.unwrap(),
109-
StoreError::Stream(err) => Response::builder()
109+
Self::Stream(err) => Response::builder()
110110
.status(StatusCode::BAD_REQUEST)
111111
.body(Body::from(format!(
112112
"Failed to read multipart stream: {err:#}"
113113
)))
114114
.unwrap(),
115-
StoreError::ReadDicomFile(err) => Response::builder()
115+
Self::ReadDicomFile(err) => Response::builder()
116116
.status(StatusCode::BAD_REQUEST)
117117
.body(Body::from(format!("Failed to read DICOM file: {err:#}")))
118118
.unwrap(),
@@ -130,10 +130,10 @@ impl From<multer::Error> for StoreError {
130130
.is_some();
131131

132132
if is_limit_exceeded {
133-
return StoreError::UploadLimitExceeded;
133+
return Self::UploadLimitExceeded;
134134
}
135135
}
136136

137-
StoreError::Stream(error)
137+
Self::Stream(error)
138138
}
139139
}

src/api/wado/routes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async fn instance_resource(
8585
Response::builder()
8686
.header(
8787
CONTENT_DISPOSITION,
88-
format!(r#"attachment; filename="{study_instance_uid}""#,),
88+
format!(r#"attachment; filename="{study_instance_uid}""#),
8989
)
9090
.header(
9191
CONTENT_TYPE,

src/backend/dimse/cfind/findscu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ impl FindServiceClassUser {
4343
Self { pool, timeout }
4444
}
4545

46+
#[allow(clippy::significant_drop_tightening)]
4647
pub fn invoke(
4748
&self,
4849
options: FindServiceClassUserOptions,

src/backend/dimse/cmove/movescu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ impl MoveServiceClassUser {
2323
}
2424

2525
#[instrument(skip_all, name = "MOVE-SCU")]
26+
#[allow(clippy::significant_drop_tightening)]
2627
pub async fn invoke(&self, request: CompositeMoveRequest) -> Result<(), MoveError> {
2728
let association = self
2829
.pool

src/backend/dimse/cstore/storescu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl StoreServiceClassUser {
2121
Self { pool, timeout }
2222
}
2323

24+
#[allow(clippy::significant_drop_tightening)]
2425
pub async fn store(&self, file: FileDicomObject<InMemDicomObject>) -> Result<(), StoreError> {
2526
let association = self
2627
.pool

src/backend/dimse/wado.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<'a> DicomMultipartStream<'a> {
271271
) -> Self {
272272
let transfer_syntax_uid =
273273
transfer_syntax_uid.and_then(|ts_uid| TransferSyntaxRegistry.get(ts_uid));
274-
274+
#[allow(clippy::result_large_err)]
275275
let multipart_stream = stream
276276
.map(move |item| {
277277
let transfer_syntax_uid = transfer_syntax_uid;

src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::config::{AppConfig, HttpServerConfig};
1414
use crate::types::AE;
1515
use association::pool::AssociationPools;
1616
use axum::extract::{DefaultBodyLimit, Request};
17+
use axum::http::StatusCode;
1718
use axum::response::Response;
1819
use axum::ServiceExt;
1920
use std::net::SocketAddr;
@@ -143,9 +144,10 @@ async fn run(config: AppConfig) -> anyhow::Result<()> {
143144
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
144145
)
145146
.layer(DefaultBodyLimit::max(config.server.http.max_upload_size))
146-
.layer(TimeoutLayer::new(Duration::from_secs(
147-
config.server.http.request_timeout,
148-
)))
147+
.layer(TimeoutLayer::with_status_code(
148+
StatusCode::REQUEST_TIMEOUT,
149+
Duration::from_secs(config.server.http.request_timeout),
150+
))
149151
.with_state(app_state);
150152

151153
let app = NormalizePathLayer::trim_trailing_slash().layer(app);

tests/common/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ pub struct ServerProcess {
3434

3535
impl ServerProcess {
3636
fn spawn(config: &str) -> anyhow::Result<Self> {
37-
let workdir =
38-
std::env::temp_dir().join(format!("dicom-rst-{}", uuid::Uuid::new_v4().to_string()));
37+
let workdir = std::env::temp_dir().join(format!("dicom-rst-{}", uuid::Uuid::new_v4()));
3938
std::fs::create_dir_all(&workdir)?;
4039
std::fs::write(workdir.join("config.yaml"), config)?;
4140

tests/stow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use dicom::object::open_file;
88
use dicom_web::DicomWebError;
99
use std::time::{Duration, Instant};
1010

11+
#[allow(clippy::redundant_closure_for_method_calls)]
1112
#[tokio::test]
1213
async fn can_upload_study_instances() -> anyhow::Result<()> {
1314
let config = "

0 commit comments

Comments
 (0)