Skip to content

Commit 90cab38

Browse files
compiler-errorsgitbot
authored and
gitbot
committed
Rename field in OnceWith from gen to make
1 parent 4d9c35f commit 90cab38

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/iter/sources/once_with.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ use crate::iter::{FusedIterator, TrustedLen};
5858
/// ```
5959
#[inline]
6060
#[stable(feature = "iter_once_with", since = "1.43.0")]
61-
pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
62-
OnceWith { gen: Some(gen) }
61+
pub fn once_with<A, F: FnOnce() -> A>(make: F) -> OnceWith<F> {
62+
OnceWith { make: Some(make) }
6363
}
6464

6565
/// An iterator that yields a single element of type `A` by
@@ -70,13 +70,13 @@ pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
7070
#[derive(Clone)]
7171
#[stable(feature = "iter_once_with", since = "1.43.0")]
7272
pub struct OnceWith<F> {
73-
gen: Option<F>,
73+
make: Option<F>,
7474
}
7575

7676
#[stable(feature = "iter_once_with_debug", since = "1.68.0")]
7777
impl<F> fmt::Debug for OnceWith<F> {
7878
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
79-
if self.gen.is_some() {
79+
if self.make.is_some() {
8080
f.write_str("OnceWith(Some(_))")
8181
} else {
8282
f.write_str("OnceWith(None)")
@@ -90,13 +90,13 @@ impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
9090

9191
#[inline]
9292
fn next(&mut self) -> Option<A> {
93-
let f = self.gen.take()?;
93+
let f = self.make.take()?;
9494
Some(f())
9595
}
9696

9797
#[inline]
9898
fn size_hint(&self) -> (usize, Option<usize>) {
99-
self.gen.iter().size_hint()
99+
self.make.iter().size_hint()
100100
}
101101
}
102102

@@ -110,7 +110,7 @@ impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> {
110110
#[stable(feature = "iter_once_with", since = "1.43.0")]
111111
impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F> {
112112
fn len(&self) -> usize {
113-
self.gen.iter().len()
113+
self.make.iter().len()
114114
}
115115
}
116116

0 commit comments

Comments
 (0)