Use inner iterator may_have_side_effect for Cloned
Previous implementation wasn't correct, as an inner iterator could have had side effects.
This commit is contained in:
parent
21cb46a6e9
commit
3eddc743f2
1 changed files with 3 additions and 1 deletions
|
@ -602,7 +602,9 @@ unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned<I>
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn may_have_side_effect() -> bool { false }
|
||||
fn may_have_side_effect() -> bool {
|
||||
I::may_have_side_effect()
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue