diff --git a/core/src/dictionary/data_element.rs b/core/src/dictionary/data_element.rs index 72ff0a31d..9c033d495 100644 --- a/core/src/dictionary/data_element.rs +++ b/core/src/dictionary/data_element.rs @@ -441,7 +441,7 @@ pub struct DataDictionaryEntryRef<'a> { pub vr: VirtualVr, } -impl<'a> DataDictionaryEntry for DataDictionaryEntryRef<'a> { +impl DataDictionaryEntry for DataDictionaryEntryRef<'_> { fn tag_range(&self) -> TagRange { self.tag } diff --git a/core/src/dictionary/stub.rs b/core/src/dictionary/stub.rs index 3143bd534..ed7e5a157 100644 --- a/core/src/dictionary/stub.rs +++ b/core/src/dictionary/stub.rs @@ -18,7 +18,7 @@ impl DataDictionary for StubDataDictionary { } } -impl<'a> DataDictionary for &'a StubDataDictionary { +impl DataDictionary for &'_ StubDataDictionary { type Entry = DataDictionaryEntryRef<'static>; fn by_name(&self, _: &str) -> Option<&DataDictionaryEntryRef<'static>> { None diff --git a/core/src/dictionary/uid.rs b/core/src/dictionary/uid.rs index 88473efc1..6c605605a 100644 --- a/core/src/dictionary/uid.rs +++ b/core/src/dictionary/uid.rs @@ -75,7 +75,7 @@ impl<'a> UidDictionaryEntryRef<'a> { } } -impl<'a> UidDictionaryEntry for UidDictionaryEntryRef<'a> { +impl UidDictionaryEntry for UidDictionaryEntryRef<'_> { fn uid(&self) -> &str { self.uid } diff --git a/core/src/header.rs b/core/src/header.rs index a6abd8bf8..a5933fca9 100644 --- a/core/src/header.rs +++ b/core/src/header.rs @@ -176,21 +176,21 @@ impl HasLength for &DataElement { } } -impl<'a, I, P> Header for &'a DataElement { +impl Header for &'_ DataElement { #[inline] fn tag(&self) -> Tag { (**self).tag() } } -impl<'v, I, P> HasLength for DataElementRef<'v, I, P> { +impl HasLength for DataElementRef<'_, I, P> { #[inline] fn length(&self) -> Length { self.header.length() } } -impl<'v, I, P> Header for DataElementRef<'v, I, P> { +impl Header for DataElementRef<'_, I, P> { #[inline] fn tag(&self) -> Tag { self.header.tag() diff --git a/core/src/value/person_name.rs b/core/src/value/person_name.rs index 73bf699ca..79001d1f3 100644 --- a/core/src/value/person_name.rs +++ b/core/src/value/person_name.rs @@ -214,7 +214,7 @@ impl<'a> PersonNameBuilder<'a> { } } -impl<'a> Default for PersonNameBuilder<'a> { +impl Default for PersonNameBuilder<'_> { fn default() -> Self { Self::new() } diff --git a/core/src/value/primitive.rs b/core/src/value/primitive.rs index 3f0d5a8ca..604d5b679 100644 --- a/core/src/value/primitive.rs +++ b/core/src/value/primitive.rs @@ -336,7 +336,7 @@ impl From<&[u8]> for PrimitiveValue { } } -impl<'a> From> for PrimitiveValue { +impl From> for PrimitiveValue { fn from(p: PersonName) -> Self { PrimitiveValue::Str(p.to_dicom_string()) } @@ -578,16 +578,16 @@ impl PrimitiveValue { match self { PrimitiveValue::Empty => Cow::from(""), PrimitiveValue::Str(values) => { - Cow::from(values.trim_end_matches(|c| c == ' ' || c == '\u{0}')) + Cow::from(values.trim_end_matches([' ', '\u{0}'])) } PrimitiveValue::Strs(values) => { if values.len() == 1 { - Cow::from(values[0].trim_end_matches(|c| c == ' ' || c == '\u{0}')) + Cow::from(values[0].trim_end_matches([' ', '\u{0}'])) } else { Cow::Owned( values .iter() - .map(|s| s.trim_end_matches(|c| c == ' ' || c == '\u{0}')) + .map(|s| s.trim_end_matches([' ', '\u{0}'])) .join("\\"), ) } diff --git a/dictionary-std/src/data_element.rs b/dictionary-std/src/data_element.rs index cd22f85b3..a47aa44d1 100644 --- a/dictionary-std/src/data_element.rs +++ b/dictionary-std/src/data_element.rs @@ -138,7 +138,7 @@ impl DataDictionary for StandardDataDictionary { } } -impl<'a> DataDictionary for &'a StandardDataDictionary { +impl DataDictionary for &'_ StandardDataDictionary { type Entry = DataDictionaryEntryRef<'static>; fn by_name(&self, name: &str) -> Option<&'static DataDictionaryEntryRef<'static>> { diff --git a/encoding/src/decode/mod.rs b/encoding/src/decode/mod.rs index 3dc7db730..419d67737 100644 --- a/encoding/src/decode/mod.rs +++ b/encoding/src/decode/mod.rs @@ -372,7 +372,7 @@ where } } -impl<'a, T: ?Sized> BasicDecode for &'a T +impl BasicDecode for &'_ T where T: BasicDecode, { @@ -560,7 +560,7 @@ where } } -impl<'a, T: ?Sized> Decode for &'a T +impl Decode for &'_ T where T: Decode, { diff --git a/encoding/src/text.rs b/encoding/src/text.rs index 6d19cd844..919b6b8f2 100644 --- a/encoding/src/text.rs +++ b/encoding/src/text.rs @@ -103,7 +103,7 @@ where } } -impl<'a, T: ?Sized> TextCodec for &'a T +impl TextCodec for &'_ T where T: TextCodec, { diff --git a/encoding/src/transfer_syntax/mod.rs b/encoding/src/transfer_syntax/mod.rs index 3f128353d..570c6cfd5 100644 --- a/encoding/src/transfer_syntax/mod.rs +++ b/encoding/src/transfer_syntax/mod.rs @@ -348,7 +348,7 @@ pub type DynDataRWAdapter = Box< + Sync, >; -impl<'a, T, R, W> DataRWAdapter for &'a T +impl DataRWAdapter for &'_ T where T: DataRWAdapter, R: Read, diff --git a/json/src/ser/mod.rs b/json/src/ser/mod.rs index 525743f64..b7b3ba42d 100644 --- a/json/src/ser/mod.rs +++ b/json/src/ser/mod.rs @@ -164,7 +164,7 @@ impl<'a, D> From<&'a [InMemDicomObject]> for DicomJson<&'a [InMemDicomObject< } } -impl<'a, D> Serialize for DicomJson<&'a [InMemDicomObject]> { +impl Serialize for DicomJson<&'_ [InMemDicomObject]> { /// Serializes the sequence of DICOM objects into a JSON array. fn serialize(&self, serializer: S) -> Result where diff --git a/json/src/ser/value.rs b/json/src/ser/value.rs index 5da391190..40e403538 100644 --- a/json/src/ser/value.rs +++ b/json/src/ser/value.rs @@ -21,7 +21,7 @@ impl<'a> From<&'a PrimitiveValue> for AsStrings<'a> { } } -impl<'a> Serialize for AsStrings<'a> { +impl Serialize for AsStrings<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -49,7 +49,7 @@ impl<'a> From<&'a PrimitiveValue> for AsNumbers<'a> { } } -impl<'a> Serialize for AsNumbers<'a> { +impl Serialize for AsNumbers<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -137,7 +137,7 @@ impl<'a> From<&'a PrimitiveValue> for InlineBinary<'a> { } } -impl<'a> Serialize for InlineBinary<'a> { +impl Serialize for InlineBinary<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -164,7 +164,7 @@ impl<'a> From<&'a PrimitiveValue> for AsPersonNames<'a> { } } -impl<'a> Serialize for AsPersonNames<'a> { +impl Serialize for AsPersonNames<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/object/src/mem.rs b/object/src/mem.rs index 9cdd8ff64..5607d7922 100644 --- a/object/src/mem.rs +++ b/object/src/mem.rs @@ -940,11 +940,10 @@ where /// reporting whether it was present. pub fn remove_element_by_name(&mut self, name: &str) -> Result { let tag = self.lookup_name(name)?; - Ok(self.entries.remove(&tag).is_some()).map(|removed| { + Ok(self.entries.remove(&tag).is_some()).inspect(|&removed| { if removed { self.len = Length::UNDEFINED; } - removed }) } @@ -952,9 +951,8 @@ where pub fn take_element(&mut self, tag: Tag) -> Result> { self.entries .remove(&tag) - .map(|e| { + .inspect(|_| { self.len = Length::UNDEFINED; - e }) .context(NoSuchDataElementTagSnafu { tag }) } @@ -963,9 +961,8 @@ where /// if it is present, /// returns `None` otherwise. pub fn take(&mut self, tag: Tag) -> Option> { - self.entries.remove(&tag).map(|e| { + self.entries.remove(&tag).inspect(|_| { self.len = Length::UNDEFINED; - e }) } @@ -977,9 +974,8 @@ where let tag = self.lookup_name(name)?; self.entries .remove(&tag) - .map(|e| { + .inspect(|_| { self.len = Length::UNDEFINED; - e }) .with_context(|| NoSuchDataElementAliasSnafu { tag, diff --git a/parser/src/stateful/decode.rs b/parser/src/stateful/decode.rs index c771e6c08..1e5d8dd6e 100644 --- a/parser/src/stateful/decode.rs +++ b/parser/src/stateful/decode.rs @@ -819,7 +819,7 @@ where } } -impl<'a, D> StatefulDecode for &'a mut D +impl StatefulDecode for &'_ mut D where D: StatefulDecode, { @@ -913,9 +913,8 @@ where .context(DecodeItemHeaderSnafu { position: self.position, }) - .map(|header| { + .inspect(|_| { self.position += 8; - header }) .map_err(From::from) } diff --git a/parser/src/stateful/encode.rs b/parser/src/stateful/encode.rs index 7dc91fe3d..bedf43040 100644 --- a/parser/src/stateful/encode.rs +++ b/parser/src/stateful/encode.rs @@ -396,7 +396,7 @@ where position: self.bytes_written, })?; let len = if textual_value.len() % 2 == 1 { - self.to.write_all(&[b' ']).context(WriteValueDataSnafu { + self.to.write_all(b" ").context(WriteValueDataSnafu { position: self.bytes_written, })?; textual_value.len() as u64 + 1 diff --git a/pixeldata/src/lib.rs b/pixeldata/src/lib.rs index e5c2bbdf8..f9a8616c4 100644 --- a/pixeldata/src/lib.rs +++ b/pixeldata/src/lib.rs @@ -1569,8 +1569,9 @@ impl DecodedPixelData<'_> { /// To change this behavior, /// see [`to_ndarray_with_options`](Self::to_ndarray_with_options). #[cfg(feature = "ndarray")] - pub fn to_ndarray(&self) -> Result> + pub fn to_ndarray(&self) -> Result> where + T: 'static, T: NumCast, T: Copy, T: Send + Sync, @@ -1603,11 +1604,9 @@ impl DecodedPixelData<'_> { /// Note that certain options may be ignored /// if they do not apply. #[cfg(feature = "ndarray")] - pub fn to_ndarray_with_options( - &self, - options: &ConvertOptions, - ) -> Result> + pub fn to_ndarray_with_options(&self, options: &ConvertOptions) -> Result> where + T: 'static, T: NumCast, T: Copy, T: Send + Sync, @@ -1647,8 +1646,9 @@ impl DecodedPixelData<'_> { /// To change this behavior, /// see [`to_ndarray_frame_with_options`](Self::to_ndarray_frame_with_options). #[cfg(feature = "ndarray")] - pub fn to_ndarray_frame(&self, frame: u32) -> Result> + pub fn to_ndarray_frame(&self, frame: u32) -> Result> where + T: 'static, T: NumCast, T: Copy, T: Send + Sync, @@ -1680,12 +1680,13 @@ impl DecodedPixelData<'_> { /// Note that certain options may be ignored /// if they do not apply. #[cfg(feature = "ndarray")] - pub fn to_ndarray_frame_with_options( + pub fn to_ndarray_frame_with_options( &self, frame: u32, options: &ConvertOptions, ) -> Result> where + T: 'static, T: NumCast, T: Copy, T: Send + Sync, diff --git a/ul/src/association/client.rs b/ul/src/association/client.rs index 564447efc..8767276bf 100644 --- a/ul/src/association/client.rs +++ b/ul/src/association/client.rs @@ -271,7 +271,7 @@ pub struct ClientAssociationOptions<'a> { connection_timeout: Option, } -impl<'a> Default for ClientAssociationOptions<'a> { +impl Default for ClientAssociationOptions<'_> { fn default() -> Self { ClientAssociationOptions { // the calling AE title diff --git a/ul/src/association/server.rs b/ul/src/association/server.rs index de4824b54..210d8955e 100644 --- a/ul/src/association/server.rs +++ b/ul/src/association/server.rs @@ -298,7 +298,7 @@ pub struct ServerAssociationOptions<'a, A> { timeout: Option, } -impl<'a> Default for ServerAssociationOptions<'a, AcceptAny> { +impl Default for ServerAssociationOptions<'_, AcceptAny> { fn default() -> Self { ServerAssociationOptions { ae_access_control: AcceptAny, @@ -315,7 +315,7 @@ impl<'a> Default for ServerAssociationOptions<'a, AcceptAny> { } } -impl<'a> ServerAssociationOptions<'a, AcceptAny> { +impl ServerAssociationOptions<'_, AcceptAny> { /// Create a new set of options for establishing an association. pub fn new() -> Self { Self::default()