Skip to content

Commit

Permalink
Borrow instead of consuming in EventReader::clear (#6851)
Browse files Browse the repository at this point in the history
The PR fixes the interface of `EventReader::clear`. Currently, the method consumes the reader, which makes it unusable.

## Changelog

- `EventReader::clear` now takes a mutable reference instead of consuming the event reader.
  • Loading branch information
mvlabat committed Dec 5, 2022
1 parent 05b498a commit faf5ea3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> {
/// In those situations you generally want to consume those events to make sure they don't appear in the next frame.
///
/// For more information see [`EventReader::is_empty()`].
pub fn clear(mut self) {
pub fn clear(&mut self) {
self.iter().last();
}
}
Expand Down

0 comments on commit faf5ea3

Please sign in to comment.