Skip to content

Commit 495b775

Browse files
committed
Fix trailing whitespace, punctuation
1 parent 9e0f1ae commit 495b775

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

library/core/src/iter/traits/peekable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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
///

library/core/src/slice/iter/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)