Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup (beta toolchain checks) #482

Merged
merged 12 commits into from
Mar 20, 2024
2 changes: 0 additions & 2 deletions core/src/dictionary/data_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ enum ParseSelectorErrorInner {
ParseKey,
/// invalid item index, should be an unsigned integer
ParseItemIndex,
/// intermediate selector step should select a sequence item
ParseItem,
/// last selector step should select a plain tag
ParseLeaf,
}
Expand Down
10 changes: 3 additions & 7 deletions core/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ impl PartialOrd<Length> for Length {
}
}

impl ::std::ops::Add<Length> for Length {
impl std::ops::Add<Length> for Length {
type Output = Self;

fn add(self, rhs: Length) -> Self::Output {
Expand All @@ -1235,7 +1235,7 @@ impl ::std::ops::Add<Length> for Length {
}
}

impl ::std::ops::Add<i32> for Length {
impl std::ops::Add<i32> for Length {
type Output = Self;

fn add(self, rhs: i32) -> Self::Output {
Expand Down Expand Up @@ -1357,11 +1357,7 @@ impl fmt::Display for Length {
#[cfg(test)]
mod tests {
use super::*;
use crate::{
dicom_value,
value::{InMemFragment, PixelFragmentSequence},
DicomValue,
};
use crate::{dicom_value, value::PixelFragmentSequence, DicomValue};

#[test]
fn to_clean_string() {
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ macro_rules! dicom_value {

#[cfg(test)]
mod tests {
use crate::dicom_value;
use crate::value::PrimitiveValue;
use smallvec::smallvec;

Expand Down
1 change: 0 additions & 1 deletion core/src/value/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ pub fn parse_datetime_partial(buf: &[u8]) -> Result<DicomDateTime> {
#[cfg(test)]
mod tests {
use super::*;
use chrono::{FixedOffset, NaiveDate, NaiveTime};

#[test]
fn test_parse_date() {
Expand Down
1 change: 0 additions & 1 deletion core/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,6 @@ impl<P> DicomValueType for PixelFragmentSequence<P> {
mod tests {
use super::*;
use crate::dicom_value;
use crate::header::EmptyObject;
use smallvec::smallvec;

#[test]
Expand Down
4 changes: 1 addition & 3 deletions core/src/value/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,10 +987,8 @@ impl PartialOrd for PreciseDateTime {

#[cfg(test)]
mod tests {
use crate::value::range::AsRange;

use super::*;
use chrono::{NaiveDateTime, TimeZone};
use chrono::TimeZone;

#[test]
fn test_dicom_date() {
Expand Down
11 changes: 8 additions & 3 deletions encoding/src/decode/explicit_be.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
//! Explicit VR Big Endian syntax transfer implementation.

use crate::decode::basic::BigEndianBasicDecoder;
use crate::decode::*;
use crate::decode::{BasicDecode, Decode, DecodeFrom};
use crate::decode::{
BadSequenceHeaderSnafu, BasicDecode, Decode, DecodeFrom, ReadHeaderTagSnafu,
ReadItemHeaderSnafu, ReadItemLengthSnafu, ReadLengthSnafu, ReadReservedSnafu, ReadTagSnafu,
ReadVrSnafu, Result,
};
use byteordered::byteorder::{BigEndian, ByteOrder};
use dicom_core::header::{DataElementHeader, Length, SequenceItemHeader};
use dicom_core::{Tag, VR};
Expand Down Expand Up @@ -65,7 +68,9 @@ impl Decode for ExplicitVRBigEndianDecoder {
}
_ => {
// read 2 bytes for the data length
source.read_exact(&mut buf[0..2]).context(ReadLengthSnafu)?;
source
.read_exact(&mut buf[0..2])
.context(ReadItemLengthSnafu)?;
bytes_read = 8;
u32::from(BigEndian::read_u16(&buf[0..2]))
}
Expand Down
6 changes: 5 additions & 1 deletion encoding/src/decode/explicit_le.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! Explicit VR Little Endian syntax transfer implementation

use crate::decode::basic::LittleEndianBasicDecoder;
use crate::decode::*;
use crate::decode::{
BadSequenceHeaderSnafu, BasicDecode, Decode, DecodeFrom, ReadHeaderTagSnafu,
ReadItemHeaderSnafu, ReadItemLengthSnafu, ReadLengthSnafu, ReadReservedSnafu, ReadTagSnafu,
ReadVrSnafu, Result,
};
use byteordered::byteorder::{ByteOrder, LittleEndian};
use dicom_core::header::{DataElementHeader, Length, SequenceItemHeader};
use dicom_core::{Tag, VR};
Expand Down
6 changes: 5 additions & 1 deletion encoding/src/decode/implicit_le.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! Implicit VR Big Endian syntax transfer implementation

use crate::decode::basic::LittleEndianBasicDecoder;
use crate::decode::*;
use crate::decode::{
BadSequenceHeaderSnafu, BasicDecode, DecodeFrom, ReadHeaderTagSnafu, ReadLengthSnafu,
ReadTagSnafu, Result,
};
use crate::Decode;
use byteordered::byteorder::{ByteOrder, LittleEndian};
use dicom_core::dictionary::{DataDictionary, DataDictionaryEntry};
use dicom_core::header::{DataElementHeader, Length, SequenceItemHeader};
Expand Down
Loading
Loading