Merge pull request #438 from Malvineous/patch-3

Make sequences wrap around to avoid overflows
This commit is contained in:
Sasha Hilton 2020-02-27 02:15:33 +00:00 committed by GitHub
commit 66f8a98ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ pub trait Seq {
macro_rules! impl_seq {
($($ty:ty)*) => { $(
impl Seq for $ty {
fn next(&self) -> Self { *self + 1 }
fn next(&self) -> Self { (*self).wrapping_add(1) }
}
)* }
}