Skip to content

Commit

Permalink
Fixed clippy warnings and GitHib CI for MSRV v1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Dec 10, 2024
1 parent 406bb6d commit 912c343
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
rust:
- stable
- 1.65.0
- 1.73.0
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand All @@ -35,7 +35,7 @@ jobs:
# matrix:
# rust:
# - stable
# - 1.65.0
# - 1.73.0
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
matrix:
rust:
- stable
- 1.65.0
- 1.73.0
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down
10 changes: 5 additions & 5 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
use std::{
collections::HashMap,
marker::PhantomData,
mem,
mem::size_of,
os::raw::{c_int, c_longlong},
};

Expand Down Expand Up @@ -356,14 +356,14 @@ pub struct Iter<'a, T: 'a> {
step: isize,
}

impl<'a, T> Iter<'a, T> {
impl<T> Iter<'_, T> {
/// Create an iterator to move channel data out of a buffer.
pub fn new(buf: &Buffer, chan: &Channel) -> Self {
unsafe {
let begin = ffi::iio_buffer_first(buf.buf, chan.chan).cast();
let end = ffi::iio_buffer_end(buf.buf).cast();
let ptr = begin;
let step: isize = ffi::iio_buffer_step(buf.buf) / mem::size_of::<T>() as isize;
let step: isize = ffi::iio_buffer_step(buf.buf) / size_of::<T>() as isize;

Self {
_phantom: PhantomData,
Expand Down Expand Up @@ -412,7 +412,7 @@ impl<'a, T: 'a> IterMut<'a, T> {
let begin = ffi::iio_buffer_first(buf.buf, chan.chan).cast();
let end = ffi::iio_buffer_end(buf.buf).cast();
let ptr = begin;
let step: isize = ffi::iio_buffer_step(buf.buf) / mem::size_of::<T>() as isize;
let step: isize = ffi::iio_buffer_step(buf.buf) / size_of::<T>() as isize;

Self {
_phantom: PhantomData,
Expand Down Expand Up @@ -451,7 +451,7 @@ pub struct AttrIterator<'a> {
idx: usize,
}

impl<'a> Iterator for AttrIterator<'a> {
impl Iterator for AttrIterator<'_> {
type Item = String;

/// Gets the next Buffer attribute from the iterator
Expand Down
16 changes: 8 additions & 8 deletions src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{
any::TypeId,
collections::HashMap,
ffi::CString,
mem,
mem::{self, size_of, size_of_val},
os::raw::{c_char, c_int, c_longlong, c_uint, c_void},
};

Expand Down Expand Up @@ -493,7 +493,7 @@ impl Channel {
}

let n = buf.capacity();
let sz_item = mem::size_of::<T>();
let sz_item = size_of::<T>();
let sz_in = n * sz_item;

let mut v = vec![T::default(); n];
Expand All @@ -519,7 +519,7 @@ impl Channel {
}

let n = buf.capacity();
let sz_item = mem::size_of::<T>();
let sz_item = size_of::<T>();
let sz_in = n * sz_item;

let mut v = vec![T::default(); n];
Expand All @@ -546,8 +546,8 @@ impl Channel {
return Err(Error::WrongDataType);
}

let sz_item = mem::size_of::<T>();
let sz_in = mem::size_of_val(data);
let sz_item = size_of::<T>();
let sz_in = size_of_val(data);

let sz = unsafe { ffi::iio_channel_write(self.chan, buf.buf, data.as_ptr().cast(), sz_in) };

Expand All @@ -564,8 +564,8 @@ impl Channel {
return Err(Error::WrongDataType);
}

let sz_item = mem::size_of::<T>();
let sz_in = mem::size_of_val(data);
let sz_item = size_of::<T>();
let sz_in = size_of_val(data);

let sz = unsafe { ffi::iio_channel_write(self.chan, buf.buf, data.as_ptr().cast(), sz_in) };

Expand All @@ -590,7 +590,7 @@ pub struct AttrIterator<'a> {
idx: usize,
}

impl<'a> Iterator for AttrIterator<'a> {
impl Iterator for AttrIterator<'_> {
type Item = String;

/// Gets the next Channel attribute from the iterator
Expand Down
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ pub struct DeviceIterator<'a> {
idx: usize,
}

impl<'a> Iterator for DeviceIterator<'a> {
impl Iterator for DeviceIterator<'_> {
type Item = Device;

/// Gets the next Device from the iterator.
Expand All @@ -489,7 +489,7 @@ pub struct AttrIterator<'a> {
idx: usize,
}

impl<'a> Iterator for AttrIterator<'a> {
impl Iterator for AttrIterator<'_> {
type Item = (String, String);

/// Gets the next Device attribute from the iterator.
Expand Down
4 changes: 2 additions & 2 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ pub struct ChannelIterator<'a> {
idx: usize,
}

impl<'a> Iterator for ChannelIterator<'a> {
impl Iterator for ChannelIterator<'_> {
type Item = Channel;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -383,7 +383,7 @@ pub struct AttrIterator<'a> {
idx: usize,
}

impl<'a> Iterator for AttrIterator<'a> {
impl Iterator for AttrIterator<'_> {
type Item = String;

/// Gets the next Device attribute from the iterator
Expand Down
2 changes: 1 addition & 1 deletion src/scan_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub struct ScanContextIterator<'a> {
idx: u32,
}

impl<'a> Iterator for ScanContextIterator<'a> {
impl Iterator for ScanContextIterator<'_> {
type Item = (String, String);

fn next(&mut self) -> Option<Self::Item> {
Expand Down

0 comments on commit 912c343

Please sign in to comment.