Skip to content

Commit c7759c2

Browse files
committed
feat(transcode): clippy fixes
1 parent e61db5d commit c7759c2

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/api/wado/service.rs

Lines changed: 3 additions & 3 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(),
@@ -160,7 +160,7 @@ where
160160

161161
/// Extracts the transfer-syntax parameter from an Accept header value.
162162
///
163-
/// According to https://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_8.7.3.5.2.html
163+
/// According to <https://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_8.7.3.5.2.html>
164164
/// the syntax is: transfer-syntax-mtp = OWS ";" OWS %s"transfer-syntax=" ts-value
165165
///
166166
/// Examples:

src/backend/dimse/wado.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,16 @@ impl<'a> DicomMultipartStream<'a> {
269269
+ 'a,
270270
transfer_syntax_uid: Option<&str>,
271271
) -> Self {
272-
let transfer_syntax_uid = transfer_syntax_uid
273-
.map(|ts_uid| TransferSyntaxRegistry.get(&ts_uid))
274-
.flatten();
272+
let transfer_syntax_uid =
273+
transfer_syntax_uid.and_then(|ts_uid| TransferSyntaxRegistry.get(ts_uid));
275274

276275
let multipart_stream = stream
277276
.map(move |item| {
278-
let transfer_syntax_uid = transfer_syntax_uid.clone();
277+
let transfer_syntax_uid = transfer_syntax_uid;
279278
item.and_then(|object| {
280279
if let Some(ts) = transfer_syntax_uid {
281280
let mut transcoded = (*object).clone();
282-
transcoded
283-
.transcode(&ts)
284-
.map_err(|err| MoveError::Transcode(err))?;
281+
transcoded.transcode(ts).map_err(MoveError::Transcode)?;
285282
Self::write(&transcoded)
286283
.map_err(|err| MoveError::Write(WriteError::Io(err)))
287284
} else {
@@ -310,11 +307,10 @@ impl<'a> DicomMultipartStream<'a> {
310307
writeln!(buffer, "--boundary\r")?;
311308
writeln!(
312309
buffer,
313-
"Content-Type: {}; transfer-syntax=\"{}\"\r",
314-
"application/dicom",
310+
"Content-Type: application/dicom; transfer-syntax=\"{}\"\r",
315311
file.meta().transfer_syntax.trim_end_matches('\0')
316312
)?;
317-
writeln!(buffer, "Content-Length: {}\r", file_length)?;
313+
writeln!(buffer, "Content-Length: {file_length}\r")?;
318314
writeln!(buffer, "\r")?;
319315
buffer.append(&mut dcm);
320316
writeln!(buffer, "\r")?;

0 commit comments

Comments
 (0)