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

Clippy lint fixes (2024-12) #611

Merged
merged 5 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -967,7 +967,7 @@

/// Read a PDU message from the other intervenient.
pub fn receive(&mut self) -> Result<Pdu> {
use std::io::{BufRead, BufReader, Cursor};

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufRead` is imported redundantly

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufReader` is imported redundantly

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `Cursor` is imported redundantly

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufRead` is imported redundantly

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufReader` is imported redundantly

Check warning on line 970 in ul/src/association/client.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `Cursor` is imported redundantly

let mut reader = BufReader::new(&mut self.socket);

Expand Down Expand Up @@ -1170,7 +1170,7 @@
}
}

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 @@ -701,7 +701,7 @@
/// Read buffer from the socket
read_buffer: bytes::BytesMut,
/// Timeout for individual send/receive operations
timeout: Option<std::time::Duration>,

Check warning on line 704 in ul/src/association/server.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

field `timeout` is never read
}

impl<S> ServerAssociation<S> {
Expand Down Expand Up @@ -732,7 +732,7 @@

/// Read a PDU message from the other intervenient.
pub fn receive(&mut self) -> Result<Pdu> {
use std::io::{BufRead, BufReader, Cursor};

Check warning on line 735 in ul/src/association/server.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufRead` is imported redundantly

Check warning on line 735 in ul/src/association/server.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `BufReader` is imported redundantly

Check warning on line 735 in ul/src/association/server.rs

View workflow job for this annotation

GitHub Actions / Test (default) (1.72.0)

the item `Cursor` is imported redundantly

let mut reader = BufReader::new(&mut self.socket);

Expand Down Expand Up @@ -906,7 +906,7 @@
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
Loading