Skip to content

Commit bf4f088

Browse files
committed
Added missing assert, did some formating
1 parent 582a05f commit bf4f088

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/libcore/str/ascii.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ impl<'self> AsciiCast<&'self[Ascii]> for &'self [u8] {
7474
#[inline(always)]
7575
fn to_ascii(&self) -> &'self[Ascii] {
7676
assert!(self.is_ascii());
77-
7877
unsafe{ cast::transmute(*self) }
7978
}
8079

@@ -91,7 +90,6 @@ impl<'self> AsciiCast<&'self[Ascii]> for &'self str {
9190
#[inline(always)]
9291
fn to_ascii(&self) -> &'self[Ascii] {
9392
assert!(self.is_ascii());
94-
9593
let (p,len): (*u8, uint) = unsafe{ cast::transmute(*self) };
9694
unsafe{ cast::transmute((p, len - 1))}
9795
}
@@ -119,7 +117,6 @@ impl AsciiCast<Ascii> for u8 {
119117
}
120118

121119
impl AsciiCast<Ascii> for char {
122-
123120
#[inline(always)]
124121
fn to_ascii(&self) -> Ascii {
125122
assert!(self.is_ascii());
@@ -142,14 +139,14 @@ impl OwnedAsciiCast for ~[u8] {
142139
#[inline(always)]
143140
fn to_ascii_consume(self) -> ~[Ascii] {
144141
assert!(self.is_ascii());
145-
146142
unsafe {cast::transmute(self)}
147143
}
148144
}
149145

150146
impl OwnedAsciiCast for ~str {
151147
#[inline(always)]
152148
fn to_ascii_consume(self) -> ~[Ascii] {
149+
assert!(self.is_ascii());
153150
let mut s = self;
154151
unsafe {
155152
str::raw::pop_byte(&mut s);
@@ -269,11 +266,3 @@ mod tests {
269266
#[test] #[should_fail]
270267
fn test_ascii_fail_char_slice() { 'λ'.to_ascii(); }
271268
}
272-
273-
274-
275-
276-
277-
278-
279-

0 commit comments

Comments
 (0)