Skip to content

Commit 5b364ab

Browse files
committed
Update for numeric trait changes
1 parent 203a5e5 commit 5b364ab

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

message.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,11 @@ impl<W: Writer> WriteMessage for W {
229229
None => ()
230230
}
231231

232+
let buf = buf.unwrap();
233+
232234
// add size of length value
233-
self.write_be_i32((buf.get_ref().len() + mem::size_of::<i32>())
234-
as i32);
235-
self.write(buf.unwrap());
235+
self.write_be_i32((buf.len() + mem::size_of::<i32>()) as i32);
236+
self.write(buf);
236237
}
237238
}
238239

types/range.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
extern mod extra;
55

66
use std::cmp;
7+
use std::i32;
8+
use std::i64;
79
use extra::time::Timespec;
810

911
macro_rules! range(
@@ -54,17 +56,17 @@ pub trait Normalizable {
5456
}
5557

5658
macro_rules! bounded_normalizable(
57-
($t:ty) => (
59+
($t:ident) => (
5860
impl Normalizable for $t {
5961
fn normalize<S: BoundSided>(bound: RangeBound<S, $t>)
6062
-> RangeBound<S, $t> {
6163
match (BoundSided::side(None::<S>), bound.type_) {
6264
(Upper, Inclusive) => {
63-
assert!(bound.value != Bounded::max_value());
65+
assert!(bound.value != $t::max_value);
6466
RangeBound::new(bound.value + 1, Exclusive)
6567
}
6668
(Lower, Exclusive) => {
67-
assert!(bound.value != Bounded::max_value());
69+
assert!(bound.value != $t::max_value);
6870
RangeBound::new(bound.value + 1, Inclusive)
6971
}
7072
_ => bound
@@ -281,6 +283,8 @@ impl<T: Ord+Normalizable+Clone> Range<T> {
281283

282284
#[cfg(test)]
283285
mod test {
286+
use std::i32;
287+
284288
use super::*;
285289

286290
#[test]
@@ -364,17 +368,17 @@ mod test {
364368
let r = range!('(', 3i32 ']');
365369
assert!(!r.contains(&4));
366370
assert!(r.contains(&2));
367-
assert!(r.contains(&Bounded::min_value()));
371+
assert!(r.contains(&i32::min_value));
368372

369373
let r = range!('[' 1i32, ')');
370-
assert!(r.contains(&Bounded::max_value()));
374+
assert!(r.contains(&i32::max_value));
371375
assert!(r.contains(&4));
372376
assert!(!r.contains(&0));
373377

374378
let r = range!('(', ')');
375-
assert!(r.contains(&Bounded::max_value()));
379+
assert!(r.contains(&i32::max_value));
376380
assert!(r.contains(&0i32));
377-
assert!(r.contains(&Bounded::min_value()));
381+
assert!(r.contains(&i32::min_value));
378382
}
379383

380384
#[test]

0 commit comments

Comments
 (0)