Skip to content

Commit 1f15e78

Browse files
authored
doubly-linked-list: Allow should_implement_trait (#1029)
It's understandable that clippy says the `next` here conflicts with Iterator's `next`, but I really think that's the best name for it unless we go with something like `forward` and `back`. There is one other example of Cursors on the internet: https://contain-rs.github.io/linked-list/linked_list/struct.Cursor.html This one also uses `next`, so it seems they did not find a better solution to this than we could. Helps address #1011 Helps address #1012
1 parent 53acb5e commit 1f15e78

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

exercises/doubly-linked-list/example.rs

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl<T> Cursor<'_, T> {
143143
}
144144
}
145145

146+
#[allow(clippy::should_implement_trait)]
146147
pub fn next(&mut self) -> Option<&mut T> {
147148
// safe as node.next is a valid potential pointer
148149
unsafe { self._step(|node| node.next) }

exercises/doubly-linked-list/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl<T> Cursor<'_, T> {
5353

5454
/// Move one position forward (towards the back) and
5555
/// return a reference to the new position
56+
#[allow(clippy::should_implement_trait)]
5657
pub fn next(&mut self) -> Option<&mut T> {
5758
unimplemented!()
5859
}

0 commit comments

Comments
 (0)