Remove some deprecated functions

This commit is contained in:
Erick Tryzelaar 2015-01-17 21:23:30 -08:00
parent 75d5f27f8a
commit b58fffbc37
2 changed files with 23 additions and 34 deletions

View File

@ -123,7 +123,7 @@ pub trait Visitor {
// The unwraps in here should be safe.
let mut s = &mut [0; 4];
let len = v.encode_utf8(s).unwrap();
self.visit_str(str::from_utf8(s.slice_to(len)).unwrap())
self.visit_str(str::from_utf8(&s[..len]).unwrap())
}
fn visit_str<
@ -136,7 +136,7 @@ pub trait Visitor {
fn visit_string<
E: Error,
>(&mut self, v: String) -> Result<Self::Value, E> {
self.visit_str(v.as_slice())
self.visit_str(&v[])
}
fn visit_unit<
@ -1310,28 +1310,28 @@ mod tests {
false => vec![Token::Bool(false)],
}
test_isize {
0i => vec![Token::Isize(0)],
0i => vec![Token::I8(0)],
0i => vec![Token::I16(0)],
0i => vec![Token::I32(0)],
0i => vec![Token::I64(0)],
0i => vec![Token::Usize(0)],
0i => vec![Token::U8(0)],
0i => vec![Token::U16(0)],
0i => vec![Token::U32(0)],
0i => vec![Token::U64(0)],
0i => vec![Token::F32(0.)],
0i => vec![Token::F64(0.)],
0is => vec![Token::Isize(0)],
0is => vec![Token::I8(0)],
0is => vec![Token::I16(0)],
0is => vec![Token::I32(0)],
0is => vec![Token::I64(0)],
0is => vec![Token::Usize(0)],
0is => vec![Token::U8(0)],
0is => vec![Token::U16(0)],
0is => vec![Token::U32(0)],
0is => vec![Token::U64(0)],
0is => vec![Token::F32(0.)],
0is => vec![Token::F64(0.)],
}
test_isizes {
0i => vec![Token::Isize(0)],
test_ints {
0is => vec![Token::Isize(0)],
0i8 => vec![Token::I8(0)],
0i16 => vec![Token::I16(0)],
0i32 => vec![Token::I32(0)],
0i64 => vec![Token::I64(0)],
}
test_usizes {
0u => vec![Token::Usize(0)],
test_uints {
0us => vec![Token::Usize(0)],
0u8 => vec![Token::U8(0)],
0u16 => vec![Token::U16(0)],
0u32 => vec![Token::U32(0)],

View File

@ -104,7 +104,7 @@ pub trait Visitor {
// The unwraps in here should be safe.
let mut s = &mut [0; 4];
let len = v.encode_utf8(s).unwrap();
self.visit_str(str::from_utf8(s.slice_to(len)).unwrap())
self.visit_str(str::from_utf8(&s[..len]).unwrap())
}
fn visit_str(&mut self, value: &str) -> Result<Self::Value, Self::Error>;
@ -1063,17 +1063,6 @@ mod tests {
assert_eq!(ser.visit(&$value), Ok(()));
)+
}
};
($name:ident { $($value:expr : $ty:ty => $tokens:expr,)+ }) => {
#[test]
fn $name() {
$(
let mut ser = AssertSerializer::new($tokens);
let v:$ty = $value;
assert_eq!(ser.visit(&v), Ok(()));
)+
}
}
}
@ -1094,14 +1083,14 @@ mod tests {
false => vec![Token::Bool(false)],
}
test_isizes {
0i => vec![Token::Isize(0)],
0is => vec![Token::Isize(0)],
0i8 => vec![Token::I8(0)],
0i16 => vec![Token::I16(0)],
0i32 => vec![Token::I32(0)],
0i64 => vec![Token::I64(0)],
}
test_usizes {
0u => vec![Token::Usize(0)],
0us => vec![Token::Usize(0)],
0u8 => vec![Token::U8(0)],
0u16 => vec![Token::U16(0)],
0u32 => vec![Token::U32(0)],
@ -1119,11 +1108,11 @@ mod tests {
"abc".to_string() => vec![Token::Str("abc")],
}
test_slice {
[0].slice_to(0) => vec![
&[0][..0] => vec![
Token::SeqStart(0),
Token::SeqEnd,
],
[1, 2, 3].as_slice() => vec![
&[1, 2, 3][] => vec![
Token::SeqStart(3),
Token::SeqSep(true),
Token::I32(1),