Skip to content

Commit 544ad37

Browse files
committed
Unfold<St, F>: Debug without F: Debug
1 parent 48aae09 commit 544ad37

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libcore/iter/sources.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub fn unfold<St, T, F>(initial_state: St, f: F) -> Unfold<St, F>
444444
/// See its documentation for more.
445445
///
446446
/// [`unfold`]: fn.unfold.html
447-
#[derive(Copy, Clone, Debug)]
447+
#[derive(Copy, Clone)]
448448
#[unstable(feature = "iter_unfold", issue = /* FIXME */ "0")]
449449
pub struct Unfold<St, F> {
450450
state: St,
@@ -462,3 +462,12 @@ impl<St, T, F> Iterator for Unfold<St, F>
462462
(self.f)(&mut self.state)
463463
}
464464
}
465+
466+
#[unstable(feature = "iter_unfold", issue = /* FIXME */ "0")]
467+
impl<St: fmt::Debug, F> fmt::Debug for Unfold<St, F> {
468+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
469+
f.debug_struct("Unfold")
470+
.field("state", &self.state)
471+
.finish()
472+
}
473+
}

0 commit comments

Comments
 (0)