Skip to content

Commit

Permalink
Merge pull request #196 from artichoke/lopopolo/clippy-useless-asref
Browse files Browse the repository at this point in the history
Address `clippy::useless_asref` lint violations
  • Loading branch information
lopopolo authored Jan 17, 2024
2 parents 21c18ed + 9abf9a0 commit a1484d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/doc/implementing_self_referential_data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! Rc::unadopt(&head, tail);
//! Rc::unadopt(tail, &head);
//!
//! tail.borrow_mut().next = next.as_ref().map(Rc::clone);
//! tail.borrow_mut().next = next.clone();
//! if let Some(ref next) = next {
//! unsafe {
//! Rc::adopt_unchecked(tail, next);
Expand All @@ -42,7 +42,7 @@
//! Rc::unadopt(&head, next);
//! Rc::unadopt(next, &head);
//!
//! next.borrow_mut().prev = tail.as_ref().map(Rc::clone);
//! next.borrow_mut().prev = tail.clone();
//! if let Some(ref tail) = tail {
//! unsafe {
//! Rc::adopt_unchecked(next, tail);
Expand Down
4 changes: 2 additions & 2 deletions tests/leak_doubly_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<T> List<T> {
Rc::unadopt(&head, tail);
Rc::unadopt(tail, &head);

tail.borrow_mut().next = next.as_ref().map(Rc::clone);
tail.borrow_mut().next = next.clone();
if let Some(ref next) = next {
unsafe {
Rc::adopt_unchecked(tail, next);
Expand All @@ -36,7 +36,7 @@ impl<T> List<T> {
Rc::unadopt(&head, next);
Rc::unadopt(next, &head);

next.borrow_mut().prev = tail.as_ref().map(Rc::clone);
next.borrow_mut().prev = tail.clone();
if let Some(ref tail) = tail {
unsafe {
Rc::adopt_unchecked(next, tail);
Expand Down

0 comments on commit a1484d2

Please sign in to comment.