Skip to content

Commit 74ee788

Browse files
committed
---
yaml --- r: 82931 b: refs/heads/auto c: 50fde8c h: refs/heads/master i: 82929: 2eb34ed 82927: e23227c v: v3
1 parent 56bd808 commit 74ee788

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: da145b237241345a9b14531d37f290082c4fb5f0
16+
refs/heads/auto: 50fde8c024a30d01ed54a2d40eab7399bf1e7a3c
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libstd/num/num.rs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -353,29 +353,25 @@ pub trait ToPrimitive {
353353
/// Converts the value of `self` to an `int`.
354354
#[inline]
355355
fn to_int(&self) -> Option<int> {
356-
// XXX: Check for range.
357-
self.to_i64().and_then(|x| Some(x as int))
356+
self.to_i64().and_then(|x| x.to_int())
358357
}
359358

360359
/// Converts the value of `self` to an `i8`.
361360
#[inline]
362361
fn to_i8(&self) -> Option<i8> {
363-
// XXX: Check for range.
364-
self.to_i64().and_then(|x| Some(x as i8))
362+
self.to_i64().and_then(|x| x.to_i8())
365363
}
366364

367365
/// Converts the value of `self` to an `i16`.
368366
#[inline]
369367
fn to_i16(&self) -> Option<i16> {
370-
// XXX: Check for range.
371-
self.to_i64().and_then(|x| Some(x as i16))
368+
self.to_i64().and_then(|x| x.to_i16())
372369
}
373370

374371
/// Converts the value of `self` to an `i32`.
375372
#[inline]
376373
fn to_i32(&self) -> Option<i32> {
377-
// XXX: Check for range.
378-
self.to_i64().and_then(|x| Some(x as i32))
374+
self.to_i64().and_then(|x| x.to_i32())
379375
}
380376

381377
/// Converts the value of `self` to an `i64`.
@@ -384,50 +380,43 @@ pub trait ToPrimitive {
384380
/// Converts the value of `self` to an `uint`.
385381
#[inline]
386382
fn to_uint(&self) -> Option<uint> {
387-
// XXX: Check for range.
388-
self.to_u64().and_then(|x| Some(x as uint))
383+
self.to_u64().and_then(|x| x.to_uint())
389384
}
390385

391386
/// Converts the value of `self` to an `u8`.
392387
#[inline]
393388
fn to_u8(&self) -> Option<u8> {
394-
// XXX: Check for range.
395-
self.to_u64().and_then(|x| Some(x as u8))
389+
self.to_u64().and_then(|x| x.to_u8())
396390
}
397391

398392
/// Converts the value of `self` to an `u16`.
399393
#[inline]
400394
fn to_u16(&self) -> Option<u16> {
401-
// XXX: Check for range.
402-
self.to_u64().and_then(|x| Some(x as u16))
395+
self.to_u64().and_then(|x| x.to_u16())
403396
}
404397

405398
/// Converts the value of `self` to an `u32`.
406399
#[inline]
407400
fn to_u32(&self) -> Option<u32> {
408-
// XXX: Check for range.
409-
self.to_u64().and_then(|x| Some(x as u32))
401+
self.to_u64().and_then(|x| x.to_u32())
410402
}
411403

412404
/// Converts the value of `self` to an `u64`.
413405
#[inline]
414406
fn to_u64(&self) -> Option<u64> {
415-
// XXX: Check for range.
416-
self.to_u64().and_then(|x| Some(x as u64))
407+
self.to_u64().and_then(|x| x.to_u64())
417408
}
418409

419410
/// Converts the value of `self` to an `f32`.
420411
#[inline]
421412
fn to_f32(&self) -> Option<f32> {
422-
// XXX: Check for range.
423-
self.to_float().and_then(|x| Some(x as f32))
413+
self.to_f64().and_then(|x| x.to_f32())
424414
}
425415

426416
/// Converts the value of `self` to an `f64`.
427417
#[inline]
428418
fn to_f64(&self) -> Option<f64> {
429-
// XXX: Check for range.
430-
self.to_i64().and_then(|x| Some(x as f64))
419+
self.to_i64().and_then(|x| x.to_f64())
431420
}
432421
}
433422

0 commit comments

Comments
 (0)