Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Chain with Option fuses #70896

Merged
merged 4 commits into from
Apr 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Avoid extra &mut in Chain::fold and try_fold
  • Loading branch information
cuviper committed Apr 7, 2020
commit ce8abc63a7e1fcac4b69574e00a70352e583cec8
4 changes: 2 additions & 2 deletions src/libcore/iter/adapters/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
self.a = None;
}
if let Some(ref mut b) = self.b {
acc = b.try_fold(acc, &mut f)?;
acc = b.try_fold(acc, f)?;
self.b = None;
}
Try::from_ok(acc)
Expand All @@ -98,7 +98,7 @@ where
acc = a.fold(acc, &mut f);
}
if let Some(b) = self.b {
acc = b.fold(acc, &mut f);
acc = b.fold(acc, f);
}
acc
}
Expand Down