Skip to content

Commit

Permalink
Merge pull request #611 from Enet4/chore/clippy-lint
Browse files Browse the repository at this point in the history
Clippy lint fixes (2024-12)
  • Loading branch information
Enet4 authored Dec 7, 2024
2 parents 8b649be + ee526df commit c0a1065
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions core/src/value/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ impl PrimitiveValue {
F32(c) => c.len() * 4,
F64(c) => c.len() * 8,
Tags(c) => c.len() * 4,
Str(s) => s.as_bytes().len(),
Strs(c) => c.iter().map(|s| s.as_bytes().len() + 1).sum::<usize>() & !1,
Str(s) => s.len(),
Strs(c) => c.iter().map(|s| s.len() + 1).sum::<usize>() & !1,
Date(c) => {
c.iter()
.map(|d| PrimitiveValue::da_byte_len(d) + 1)
Expand Down
10 changes: 5 additions & 5 deletions devtools/dictionary-builder/src/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ pub fn run(args: DataElementApp) -> Result<()> {
fn parse_entries<R: BufRead>(source: R) -> Result<Vec<Entry>> {
let mut result = vec![];

let regex_tag = Regex::new(r"^\(([0-9A-F]{4}),([0-9A-F]{4})\)$")?;
let regex_tag_group100 = Regex::new(r"^\(([0-9A-F]{2})00-[0-9A-F]{2}FF,([0-9A-F]{4})\)$")?;
let regex_tag_element100 =
Regex::new(r"^\(([0-9A-F]{4}),([0-9A-F]{2})00-[0-9A-F]{2}FF\)$")?;

for line in source.lines() {
let line = line?;
if line.starts_with('#') {
Expand Down Expand Up @@ -113,11 +118,6 @@ fn parse_entries<R: BufRead>(source: R) -> Result<Vec<Entry>> {

let tag = parts[0].to_string();

let regex_tag = Regex::new(r"^\(([0-9A-F]{4}),([0-9A-F]{4})\)$")?;
let regex_tag_group100 = Regex::new(r"^\(([0-9A-F]{2})00-[0-9A-F]{2}FF,([0-9A-F]{4})\)$")?;
let regex_tag_element100 =
Regex::new(r"^\(([0-9A-F]{4}),([0-9A-F]{2})00-[0-9A-F]{2}FF\)$")?;

let cap = regex_tag.captures(tag.as_str());
let tag_type;
let tag_declaration = if let Some(cap) = cap {
Expand Down
2 changes: 1 addition & 1 deletion parser/src/dataset/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ where
source: dicom_encoding::decode::Error::ReadItemHeader { source, .. },
..
}) if source.kind() == std::io::ErrorKind::UnexpectedEof
&& self.seq_delimiters.pop().map_or(false, |t| t.pixel_data)
&& self.seq_delimiters.pop().is_some_and(|t| t.pixel_data)
=> {
// Note: if `UnexpectedEof` was reached while inside a
// PixelData Sequence, then we assume that
Expand Down
2 changes: 1 addition & 1 deletion ul/src/association/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ pub mod non_blocking {
}
}

impl<'a> ClientAssociationOptions<'a> {
impl ClientAssociationOptions<'_> {
async fn establish_impl_async<T>(
self,
ae_address: AeAddr<T>,
Expand Down
4 changes: 2 additions & 2 deletions ul/src/association/pdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl<'a, R> PDataReader<'a, R> {
}
}

impl<'a, R> Read for PDataReader<'a, R>
impl<R> Read for PDataReader<'_, R>
where
R: Read,
{
Expand Down Expand Up @@ -594,7 +594,7 @@ pub mod non_blocking {
}
}

impl<'a, R> AsyncRead for PDataReader<'a, R>
impl<R> AsyncRead for PDataReader<'_, R>
where
R: AsyncRead + Unpin,
{
Expand Down
2 changes: 1 addition & 1 deletion ul/src/association/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ pub mod non_blocking {
read_pdu, write_pdu, Pdu, IMPLEMENTATION_CLASS_UID, IMPLEMENTATION_VERSION_NAME,
};

impl<'a, A> ServerAssociationOptions<'a, A>
impl<A> ServerAssociationOptions<'_, A>
where
A: AccessControl,
{
Expand Down

0 comments on commit c0a1065

Please sign in to comment.