summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-07-15 07:55:44 -0700
committerJoe Wilm <joe@jwilm.com>2016-07-15 07:55:44 -0700
commit80f6f542abf8701de45010f5f29f4bfae74fe8cd (patch)
tree1067f664278cf5b9a2998bc0e71f6201a8d3c00f /src
parent316ccd1c3a883f447d63fd5c935cdf5f37e75157 (diff)
downloadalacritty-80f6f542abf8701de45010f5f29f4bfae74fe8cd.tar.gz
alacritty-80f6f542abf8701de45010f5f29f4bfae74fe8cd.zip
Update to latest nightly
Previous version of serde no longer worked; cargo packages were updated as a result. `Zero` and `One` traits were deprecated. Use of those was removed. The `Step` trait gained a lot more methods, and the index::$ty implementations were updated.
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs3
-rw-r--r--src/index.rs51
-rw-r--r--src/main.rs1
3 files changed, 35 insertions, 20 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index 6228ed30..496f87d0 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -529,7 +529,8 @@ impl Parser {
macro_rules! arg_or_default {
($arg:expr, $default:expr) => {
- if $arg == ::std::num::Zero::zero() { $default } else { $arg }
+ // using Default::default as a generic zero
+ if $arg == Default::default() { $default } else { $arg }
}
}
diff --git a/src/index.rs b/src/index.rs
index a4167e0d..61c39fd6 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -17,7 +17,7 @@
/// Indexing types and implementations for Grid and Line
use std::fmt;
use std::iter::Step;
-use std::num::{One, Zero};
+use std::mem;
use std::ops::{self, Deref, Add};
/// Index in the grid using row, column notation
@@ -134,31 +134,15 @@ macro_rules! sub {
}
}
-macro_rules! zero_one {
- ($ty:ty, $construct:expr) => {
- impl One for $ty {
- fn one() -> $ty {
- $construct(1)
- }
- }
-
- impl Zero for $ty {
- fn zero() -> $ty {
- $construct(0)
- }
- }
- }
-}
-
macro_rules! ops {
($ty:ty, $construct:expr) => {
add!($ty, $construct);
sub!($ty, $construct);
- zero_one!($ty, $construct);
deref!($ty, usize);
forward_ref_binop!(impl Add, add for $ty, $ty);
impl Step for $ty {
+ #[inline]
fn step(&self, by: &$ty) -> Option<$ty> {
Some(*self + *by)
}
@@ -180,6 +164,37 @@ macro_rules! ops {
Some(0)
}
}
+
+ #[inline]
+ fn steps_between_by_one(start: &$ty, end: &$ty) -> Option<usize> {
+ Step::steps_between(start, end, &$construct(1))
+ }
+
+ #[inline]
+ #[allow(unused_comparisons)]
+ fn is_negative(&self) -> bool {
+ self.0 < 0
+ }
+
+ #[inline]
+ fn replace_one(&mut self) -> Self {
+ mem::replace(self, $construct(0))
+ }
+
+ #[inline]
+ fn replace_zero(&mut self) -> Self {
+ mem::replace(self, $construct(1))
+ }
+
+ #[inline]
+ fn add_one(&self) -> Self {
+ *self + 1
+ }
+
+ #[inline]
+ fn sub_one(&self) -> Self {
+ *self - 1
+ }
}
impl ops::AddAssign<$ty> for $ty {
diff --git a/src/main.rs b/src/main.rs
index be45ed11..e24ed9f8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,6 @@
#![feature(inclusive_range_syntax)]
#![feature(drop_types_in_const)]
#![feature(unicode)]
-#![feature(zero_one)]
#![feature(step_trait)]
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]