Skip to content
Open
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
1 change: 0 additions & 1 deletion src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::ptr;

impl<V: Copy, const N: usize> Clone for Stack<V, N> {
/// Clone it.
#[must_use]
fn clone(&self) -> Self {
let mut s: Self = Self::new();
s.next = self.next;
Expand Down
1 change: 0 additions & 1 deletion src/ctors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use std::mem::MaybeUninit;
impl<V: Copy, const N: usize> Default for Stack<V, N> {
/// Make a default empty [`Stack`].
#[inline]
#[must_use]
fn default() -> Self {
Self::new()
}
Expand Down
4 changes: 2 additions & 2 deletions src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ use std::fmt;
use std::fmt::{Debug, Display, Formatter};

impl<V: Display + Copy, const N: usize> Display for Stack<V, N> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
<&Self as Debug>::fmt(&self, f)
}
}

impl<V: Display + Copy, const N: usize> Debug for Stack<V, N> {
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}"));
Expand Down
8 changes: 3 additions & 5 deletions src/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ impl<V: Copy, const N: usize> Iterator for IntoIter<V, N> {
type Item = V;

#[inline]
#[must_use]
fn next(&mut self) -> Option<Self::Item> {
if self.pos >= self.next {
None
Expand All @@ -37,7 +36,7 @@ impl<V: Copy, const N: usize> Iterator for IntoIter<V, N> {
}
}

impl<'a, V: Copy + 'a, const N: usize> Stack<V, N> {
impl<V: Copy, const N: usize> Stack<V, N> {
/// Into-iterate them.
#[inline]
pub const fn into_iter(&self) -> IntoIter<V, N> {
Expand All @@ -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<Self::Item> {
if self.pos >= self.next {
None
Expand All @@ -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<V, N> {
impl<V: Copy, const N: usize> Stack<V, N> {
/// Iterate them.
#[inline]
pub const fn iter(&self) -> Iter<V, N> {
pub const fn iter(&self) -> Iter<'_, V, N> {
Iter {
pos: 0,
next: self.next,
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Vi<V, const N: usize>(PhantomData<V>);
impl<'de, V: Copy + Deserialize<'de>, const N: usize> Visitor<'de> for Vi<V, N> {
type Value = Stack<V, N>;

fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter<'_>) -> std::fmt::Result {
formatter.write_str("a Stack")
}

Expand Down
Loading