Skip to content

Commit

Permalink
Merge pull request #482 from Enet4/chore/core/cleanup
Browse files Browse the repository at this point in the history
Code cleanup (beta toolchain checks)
  • Loading branch information
Enet4 authored Mar 20, 2024
2 parents 7c0e5ab + d3a5907 commit 9dc4521
Show file tree
Hide file tree
Showing 28 changed files with 103 additions and 152 deletions.
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

0 comments on commit 9dc4521

Please sign in to comment.