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

Fix clippy lints #160

Merged
merged 1 commit into from
Dec 9, 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
8 changes: 4 additions & 4 deletions netcdf/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ pub struct Attribute<'a> {
pub(crate) _marker: PhantomData<&'a nc_type>,
}

impl<'a> std::fmt::Debug for Attribute<'a> {
impl std::fmt::Debug for Attribute<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "name: {}", self.name())?;
write!(f, "ncid: {}", self.ncid)?;
write!(f, "varid: {}", self.varid)
}
}

impl<'a> Attribute<'a> {
impl Attribute<'_> {
/// Get the name of the attribute
///
/// # Panics
Expand Down Expand Up @@ -398,7 +398,7 @@ pub(crate) struct AttributeIterator<'a> {
_marker: PhantomData<&'a nc_type>,
}

impl<'a> AttributeIterator<'a> {
impl AttributeIterator<'_> {
pub(crate) fn new(ncid: nc_type, varid: Option<nc_type>) -> error::Result<Self> {
let mut natts = 0;
checked_with_lock(|| unsafe {
Expand Down Expand Up @@ -474,7 +474,7 @@ pub enum AttributeValue {
Strs(Vec<String>),
}

impl<'a> Attribute<'a> {
impl Attribute<'_> {
#[allow(clippy::needless_pass_by_value)] // All values will be small
#[allow(clippy::too_many_lines)]
pub(crate) fn put(
Expand Down
2 changes: 1 addition & 1 deletion netcdf/src/dimension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct DimensionIdentifier {
}

#[allow(clippy::len_without_is_empty)]
impl<'g> Dimension<'g> {
impl Dimension<'_> {
/// Get current length of this dimension
pub fn len(&self) -> usize {
if let Some(x) = self.len {
Expand Down
2 changes: 1 addition & 1 deletion netcdf/src/extent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ enum StartCountStrideIter<'a> {
Extent(std::iter::Zip<std::slice::Iter<'a, Extent>, std::slice::Iter<'a, Dimension<'a>>>),
}

impl<'a> Iterator for StartCountStrideIter<'a> {
impl Iterator for StartCountStrideIter<'_> {
type Item = StartCountStrideIterItem;
fn next(&mut self) -> Option<Self::Item> {
match self {
Expand Down
2 changes: 1 addition & 1 deletion netcdf/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl FileMut {
pub struct FileMem<'buffer>(File, std::marker::PhantomData<&'buffer [u8]>);

#[cfg(feature = "has-mmap")]
impl<'a> std::ops::Deref for FileMem<'a> {
impl std::ops::Deref for FileMem<'_> {
type Target = File;
fn deref(&self) -> &Self::Target {
&self.0
Expand Down
2 changes: 0 additions & 2 deletions netcdf/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ impl<'f> GroupMut<'f> {
crate::types::add_type(self.ncid, typ, false)
}

/// Add an opaque datatype, with `size` bytes

/// Add an attribute to the group
pub fn add_attribute<'a, T>(&'a mut self, name: &str, val: T) -> error::Result<Attribute<'a>>
where
Expand Down
10 changes: 5 additions & 5 deletions netcdf/src/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl<'g> Variable<'g> {
}
}
}
impl<'g> VariableMut<'g> {
impl VariableMut<'_> {
/// Sets compression on the variable. Must be set before filling in data.
///
/// `deflate_level` can take a value 0..=9, with 0 being no
Expand Down Expand Up @@ -289,7 +289,7 @@ impl<'g> VariableMut<'g> {
}
}

impl<'g> VariableMut<'g> {
impl VariableMut<'_> {
/// Adds an attribute to the variable
pub fn put_attribute<T>(&mut self, name: &str, val: T) -> error::Result<Attribute>
where
Expand All @@ -299,7 +299,7 @@ impl<'g> VariableMut<'g> {
}
}

impl<'g> Variable<'g> {
impl Variable<'_> {
fn get_values_mono<T: NcTypeDescriptor>(&self, extents: &Extents) -> error::Result<Vec<T>> {
let dims = self.dimensions();
let (start, count, stride) = extents.get_start_count_stride(dims)?;
Expand Down Expand Up @@ -597,7 +597,7 @@ impl<'g> Variable<'g> {
}
}

impl<'g> VariableMut<'g> {
impl VariableMut<'_> {
fn put_values_mono<T: NcTypeDescriptor>(
&mut self,
values: &[T],
Expand Down Expand Up @@ -804,7 +804,7 @@ impl<'g> VariableMut<'g> {
}
}

impl<'g> VariableMut<'g> {
impl VariableMut<'_> {
pub(crate) fn add_from_str(
ncid: nc_type,
xtype: &NcVariableType,
Expand Down
Loading