File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pub trait PeekableIterator: Iterator {
1717 /// assert_eq!(vals.next(), Some(0));
1818 ///
1919 /// // examine the pending element
20- /// assert_eq!(vals.peek_with(|x| x) , Some(& 1));
20+ /// assert_eq!(vals.peek_with(|x| x.copied()) , Some(1));
2121 /// assert_eq!(vals.next(), Some(1));
2222 ///
2323 /// // determine if the iterator has an element without advancing
@@ -26,7 +26,7 @@ pub trait PeekableIterator: Iterator {
2626 ///
2727 /// // exhausted iterator
2828 /// assert_eq!(vals.next(), None);
29- /// assert_eq!(vals.peek_with(|x| x), None);
29+ /// assert_eq!(vals.peek_with(|x| x.copied() ), None);
3030 /// ```
3131 fn peek_with < T > ( & mut self , func : impl for < ' a > FnOnce ( Option < & ' a Self :: Item > ) -> T ) -> T ;
3232
@@ -50,7 +50,7 @@ pub trait PeekableIterator: Iterator {
5050 /// } else {
5151 /// 10
5252 /// }
53- ///
53+ ///
5454 /// u32::from_str_radix(c.as_str(), base).unwrap()
5555 /// }
5656 ///
Original file line number Diff line number Diff line change @@ -475,9 +475,9 @@ macro_rules! iterator {
475475 if len!( self ) == 0 {
476476 func( None )
477477 } else {
478- // SAFETY: element within bounds as len > 0
479- // Reference is dropped after the closure completes
480- // and can not outlive the mutable borrow of self
478+ // SAFETY: Element within bounds as len > 0.
479+ // The reference is dropped after the closure completes
480+ // and can not outlive the mutable borrow of self.
481481 let tmp = unsafe { & $( $mut_ ) ? * self . ptr. as_ptr( ) } ;
482482 func( Some ( tmp) . as_ref( ) )
483483 }
You can’t perform that action at this time.
0 commit comments