diff --git a/src/clone.rs b/src/clone.rs index c872fba..a3d1af7 100644 --- a/src/clone.rs +++ b/src/clone.rs @@ -23,7 +23,6 @@ use std::ptr; impl Clone for Stack { /// Clone it. - #[must_use] fn clone(&self) -> Self { let mut s: Self = Self::new(); s.next = self.next; diff --git a/src/ctors.rs b/src/ctors.rs index 41736e9..ac3004c 100644 --- a/src/ctors.rs +++ b/src/ctors.rs @@ -24,7 +24,6 @@ use std::mem::MaybeUninit; impl Default for Stack { /// Make a default empty [`Stack`]. #[inline] - #[must_use] fn default() -> Self { Self::new() } diff --git a/src/debug.rs b/src/debug.rs index c6a1dc4..419cf82 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -23,13 +23,13 @@ use std::fmt; use std::fmt::{Debug, Display, Formatter}; impl Display for Stack { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { <&Self as Debug>::fmt(&self, f) } } impl Debug for Stack { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let mut parts = vec![]; for v in self.iter() { parts.push(format!("{v}")); diff --git a/src/iterators.rs b/src/iterators.rs index 66481e7..ab325f9 100644 --- a/src/iterators.rs +++ b/src/iterators.rs @@ -25,7 +25,6 @@ impl Iterator for IntoIter { type Item = V; #[inline] - #[must_use] fn next(&mut self) -> Option { if self.pos >= self.next { None @@ -37,7 +36,7 @@ impl Iterator for IntoIter { } } -impl<'a, V: Copy + 'a, const N: usize> Stack { +impl Stack { /// Into-iterate them. #[inline] pub const fn into_iter(&self) -> IntoIter { @@ -53,7 +52,6 @@ impl<'a, V: Copy, const N: usize> Iterator for Iter<'a, V, N> { type Item = &'a V; #[inline] - #[must_use] fn next(&mut self) -> Option { if self.pos >= self.next { None @@ -67,10 +65,10 @@ impl<'a, V: Copy, const N: usize> Iterator for Iter<'a, V, N> { } } -impl<'a, V: Copy + 'a, const N: usize> Stack { +impl Stack { /// Iterate them. #[inline] - pub const fn iter(&self) -> Iter { + pub const fn iter(&self) -> Iter<'_, V, N> { Iter { pos: 0, next: self.next, diff --git a/src/lib.rs b/src/lib.rs index c721403..35615f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,10 +38,12 @@ //! to a panic. #![doc(html_root_url = "https://docs.rs/microstack/0.0.0")] -#![deny(warnings)] +#![deny(rust_2018_idioms, unused, deprecated)] #![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)] #![allow(clippy::multiple_inherent_impl)] #![allow(clippy::multiple_crate_versions)] +#![allow(clippy::missing_const_for_fn)] +#![allow(clippy::iter_without_into_iter)] use std::marker::PhantomData; diff --git a/src/serialization.rs b/src/serialization.rs index 651f9f1..45e4976 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -43,7 +43,7 @@ struct Vi(PhantomData); impl<'de, V: Copy + Deserialize<'de>, const N: usize> Visitor<'de> for Vi { type Value = Stack; - fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut Formatter<'_>) -> std::fmt::Result { formatter.write_str("a Stack") }