Skip to content

Commit b987dcc

Browse files
committed
fix clippy warnings
1 parent b3aab62 commit b987dcc

10 files changed

Lines changed: 19 additions & 13 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
@@ -84,7 +84,7 @@ async fn instance_resource(
8484
Response::builder()
8585
.header(
8686
CONTENT_DISPOSITION,
87-
format!(r#"attachment; filename="{study_instance_uid}""#,),
87+
format!(r#"attachment; filename="{study_instance_uid}""#),
8888
)
8989
.header(
9090
CONTENT_TYPE,

src/api/wado/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ pub enum RetrieveError {
5252
impl IntoResponse for RetrieveError {
5353
fn into_response(self) -> Response {
5454
match self {
55-
RetrieveError::Backend { source } => {
55+
Self::Backend { source } => {
5656
(StatusCode::INTERNAL_SERVER_ERROR, source.to_string()).into_response()
5757
}
58-
RetrieveError::Unimplemented => Response::builder()
58+
Self::Unimplemented => Response::builder()
5959
.status(StatusCode::NOT_IMPLEMENTED)
6060
.body(Body::from("This transaction is not implemented."))
6161
.unwrap(),

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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl<'a> DicomMultipartStream<'a> {
264264
+ Send
265265
+ 'a,
266266
) -> Self {
267+
#[allow(clippy::result_large_err)]
267268
let multipart_stream = stream
268269
.map(|item| {
269270
item.and_then(|object| {

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)