Skip to content

Commit d5a23d5

Browse files
committed
Fix for upstream changes
1 parent e5b4ed0 commit d5a23d5

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/impls/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ mod test {
158158
use std::fmt;
159159

160160
use postgres::{Connection, FromSql, ToSql, SslMode};
161-
use time::{mod, Timespec};
161+
use time::{self, Timespec};
162162

163163
macro_rules! test_range {
164164
($name:expr, $t:ty, $low:expr, $low_str:expr, $high:expr, $high_str:expr) => ({

src/lib.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
extern crate postgres;
66
extern crate time;
77

8+
use std::cmp::Ordering;
89
use std::fmt;
910
use std::i32;
1011
use std::i64;
@@ -153,7 +154,7 @@ impl Normalizable for Timespec {
153154
}
154155

155156
/// The possible sides of a bound
156-
#[deriving(PartialEq, Eq, Copy)]
157+
#[derive(PartialEq, Eq, Copy)]
157158
pub enum BoundSide {
158159
/// An upper bound
159160
Upper,
@@ -190,7 +191,7 @@ impl BoundSided for LowerBound {
190191
}
191192

192193
/// The type of a range bound
193-
#[deriving(PartialEq, Eq, Clone, Copy)]
194+
#[derive(PartialEq, Eq, Clone, Copy)]
194195
pub enum BoundType {
195196
/// The bound includes its value
196197
Inclusive,
@@ -249,10 +250,10 @@ impl<S, T> PartialOrd for RangeBound<S, T> where S: BoundSided, T: PartialOrd {
249250
fn partial_cmp(&self, other: &RangeBound<S, T>) -> Option<Ordering> {
250251
match (BoundSided::side(None::<S>), self.type_, other.type_,
251252
self.value.partial_cmp(&other.value)) {
252-
(Upper, Exclusive, Inclusive, Some(Equal))
253-
| (Lower, Inclusive, Exclusive, Some(Equal)) => Some(Less),
254-
(Upper, Inclusive, Exclusive, Some(Equal))
255-
| (Lower, Exclusive, Inclusive, Some(Equal)) => Some(Greater),
253+
(Upper, Exclusive, Inclusive, Some(Ordering::Equal))
254+
| (Lower, Inclusive, Exclusive, Some(Ordering::Equal)) => Some(Ordering::Less),
255+
(Upper, Inclusive, Exclusive, Some(Ordering::Equal))
256+
| (Lower, Exclusive, Inclusive, Some(Ordering::Equal)) => Some(Ordering::Greater),
256257
(_, _, _, cmp) => cmp,
257258
}
258259
}
@@ -262,10 +263,10 @@ impl<S, T> Ord for RangeBound<S, T> where S: BoundSided, T: Ord {
262263
fn cmp(&self, other: &RangeBound<S, T>) -> Ordering {
263264
match (BoundSided::side(None::<S>), self.type_, other.type_,
264265
self.value.cmp(&other.value)) {
265-
(Upper, Exclusive, Inclusive, Equal)
266-
| (Lower, Inclusive, Exclusive, Equal) => Less,
267-
(Upper, Inclusive, Exclusive, Equal)
268-
| (Lower, Exclusive, Inclusive, Equal) => Greater,
266+
(Upper, Exclusive, Inclusive, Ordering::Equal)
267+
| (Lower, Inclusive, Exclusive, Ordering::Equal) => Ordering::Less,
268+
(Upper, Inclusive, Exclusive, Ordering::Equal)
269+
| (Lower, Exclusive, Inclusive, Ordering::Equal) => Ordering::Greater,
269270
(_, _, _, ord) => ord,
270271
}
271272
}
@@ -305,23 +306,23 @@ impl<'a, S, T> PartialEq for OptBound<'a, S, T> where S: BoundSided, T: PartialE
305306
impl<'a, S, T> PartialOrd for OptBound<'a, S, T> where S: BoundSided, T: PartialOrd {
306307
fn partial_cmp(&self, other: &OptBound<'a, S, T>) -> Option<Ordering> {
307308
match (self, other, BoundSided::side(None::<S>)) {
308-
(&OptBound(None), &OptBound(None), _) => Some(Equal),
309+
(&OptBound(None), &OptBound(None), _) => Some(Ordering::Equal),
309310
(&OptBound(None), _, Lower)
310-
| (_, &OptBound(None), Upper) => Some(Less),
311+
| (_, &OptBound(None), Upper) => Some(Ordering::Less),
311312
(&OptBound(None), _, Upper)
312-
| (_, &OptBound(None), Lower) => Some(Greater),
313+
| (_, &OptBound(None), Lower) => Some(Ordering::Greater),
313314
(&OptBound(Some(a)), &OptBound(Some(b)), _) => a.partial_cmp(b)
314315
}
315316
}
316317
}
317318

318319
/// Represents a range of values.
319-
#[deriving(PartialEq, Eq, Clone, Copy)]
320+
#[derive(PartialEq, Eq, Clone, Copy)]
320321
pub struct Range<T> {
321322
inner: InnerRange<T>,
322323
}
323324

324-
#[deriving(PartialEq, Eq, Clone, Copy)]
325+
#[derive(PartialEq, Eq, Clone, Copy)]
325326
enum InnerRange<T> {
326327
Empty,
327328
Normal(Option<RangeBound<LowerBound, T>>,

0 commit comments

Comments
 (0)