Skip to content

Commit 7164b9f

Browse files
committed
---
yaml --- r: 139755 b: refs/heads/try2 c: 0615fdd h: refs/heads/master i: 139753: f34c926 139751: 73ea86c v: v3
1 parent 2f8d34a commit 7164b9f

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c4685477e0771ee21afa6b93ea0d4ca2c7f6abd9
8+
refs/heads/try2: 0615fddd80116d63fba7040bdd89ad59117037dd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/num/num.rs

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,37 +110,29 @@ pub trait NumCast {
110110

111111
macro_rules! impl_num_cast(
112112
($T:ty, $conv:ident) => (
113-
// FIXME #4375: This enclosing module is necessary because
114-
// of a bug with macros expanding into multiple items
115-
pub mod $conv {
116-
use num::NumCast;
117-
118-
#[cfg(notest)]
119-
impl NumCast for $T {
120-
#[doc = "Cast `n` to a `$T`"]
121-
#[inline(always)]
122-
fn from<N:NumCast>(n: N) -> $T {
123-
// `$conv` could be generated using `concat_idents!`, but that
124-
// macro seems to be broken at the moment
125-
n.$conv()
126-
}
127-
128-
#[inline(always)] fn to_u8(&self) -> u8 { *self as u8 }
129-
#[inline(always)] fn to_u16(&self) -> u16 { *self as u16 }
130-
#[inline(always)] fn to_u32(&self) -> u32 { *self as u32 }
131-
#[inline(always)] fn to_u64(&self) -> u64 { *self as u64 }
132-
#[inline(always)] fn to_uint(&self) -> uint { *self as uint }
133-
134-
#[inline(always)] fn to_i8(&self) -> i8 { *self as i8 }
135-
#[inline(always)] fn to_i16(&self) -> i16 { *self as i16 }
136-
#[inline(always)] fn to_i32(&self) -> i32 { *self as i32 }
137-
#[inline(always)] fn to_i64(&self) -> i64 { *self as i64 }
138-
#[inline(always)] fn to_int(&self) -> int { *self as int }
139-
140-
#[inline(always)] fn to_f32(&self) -> f32 { *self as f32 }
141-
#[inline(always)] fn to_f64(&self) -> f64 { *self as f64 }
142-
#[inline(always)] fn to_float(&self) -> float { *self as float }
113+
impl NumCast for $T {
114+
#[inline(always)]
115+
fn from<N:NumCast>(n: N) -> $T {
116+
// `$conv` could be generated using `concat_idents!`, but that
117+
// macro seems to be broken at the moment
118+
n.$conv()
143119
}
120+
121+
#[inline(always)] fn to_u8(&self) -> u8 { *self as u8 }
122+
#[inline(always)] fn to_u16(&self) -> u16 { *self as u16 }
123+
#[inline(always)] fn to_u32(&self) -> u32 { *self as u32 }
124+
#[inline(always)] fn to_u64(&self) -> u64 { *self as u64 }
125+
#[inline(always)] fn to_uint(&self) -> uint { *self as uint }
126+
127+
#[inline(always)] fn to_i8(&self) -> i8 { *self as i8 }
128+
#[inline(always)] fn to_i16(&self) -> i16 { *self as i16 }
129+
#[inline(always)] fn to_i32(&self) -> i32 { *self as i32 }
130+
#[inline(always)] fn to_i64(&self) -> i64 { *self as i64 }
131+
#[inline(always)] fn to_int(&self) -> int { *self as int }
132+
133+
#[inline(always)] fn to_f32(&self) -> f32 { *self as f32 }
134+
#[inline(always)] fn to_f64(&self) -> f64 { *self as f64 }
135+
#[inline(always)] fn to_float(&self) -> float { *self as float }
144136
}
145137
)
146138
)

0 commit comments

Comments
 (0)