remove warnings

This commit is contained in:
Geoffroy Couprie 2015-02-20 19:37:03 +01:00
parent 1a0ff85673
commit 53a3542120
4 changed files with 16 additions and 16 deletions

View File

@ -112,7 +112,7 @@ pub trait Consumer {
}
//v2.push_all(acc.as_slice());
//match consumer.consume(v2.as_slice()) {
match self.consume(&acc[]) {
match self.consume(&acc[..]) {
ConsumerError(e) => {
println!("consumer error, stopping: {}", e);
},

View File

@ -537,7 +537,7 @@ mod tests {
#[test]
fn t1() {
let v1:Vec<u8> = vec![1,2,3];
let res = local_print(&v1[]);
assert_eq!(res, Done(&v1[], ()));
let res = local_print(&v1[..]);
assert_eq!(res, Done(&v1[..], ()));
}
}

View File

@ -840,18 +840,18 @@ mod tests {
fn buffer_with_size() {
let i:Vec<u8> = vec![7,8];
let o:Vec<u8> = vec![4,5,6];
let arr:[u8; 6us] = [3, 4, 5, 6, 7, 8];
let res = sized_buffer(&arr[]);
assert_eq!(res, Done(&i[], &o[]))
let arr:[u8; 6usize] = [3, 4, 5, 6, 7, 8];
let res = sized_buffer(&arr[..]);
assert_eq!(res, Done(&i[..], &o[..]))
}
/*#[test]
fn t1() {
let v1:Vec<u8> = vec![1,2,3];
let v2:Vec<u8> = vec![4,5,6];
let d = Done(&v1[], &v2[]);
let d = Done(&v1[..], &v2[..]);
let res = d.flat_map(print);
assert_eq!(res, Done(&v2[], ()));
assert_eq!(res, Done(&v2[..], ()));
}*/
#[derive(PartialEq,Eq,Debug)]
@ -1013,17 +1013,17 @@ mod tests {
fn length_value_test() {
let i1 = vec![7,8];
let o1 = vec![4, 5, 6];
let arr1:[u8; 6us] = [3, 4, 5, 6, 7, 8];
let arr1:[u8; 6usize] = [3, 4, 5, 6, 7, 8];
let res1 = length_value(&arr1);
assert_eq!(Done(&i1[], &o1[]), res1);
assert_eq!(Done(&i1[..], &o1[..]), res1);
let i2:Vec<u8> = vec![4,5,6,7,8];
let o2 = "";
let arr2:[u8; 6us] = [0, 4, 5, 6, 7, 8];
let arr2:[u8; 6usize] = [0, 4, 5, 6, 7, 8];
let res2 = length_value(&arr2);
assert_eq!(Done(&i2[], o2.as_bytes()), res2);
assert_eq!(Done(&i2[..], o2.as_bytes()), res2);
let arr3:[u8; 7us] = [8, 4, 5, 6, 7, 8, 9];
let arr3:[u8; 7usize] = [8, 4, 5, 6, 7, 8, 9];
let res3 = length_value(&arr3);
//FIXME: should be incomplete
assert_eq!(Error(0), res3);

View File

@ -88,7 +88,7 @@ impl Producer for FileProducer {
println!("producer error: {:?}", e);
match e.kind() {
//ErrorKind::NoProgress => Continue,
//ErrorKind::EndOfFile => Eof(&self.v[]),
//ErrorKind::EndOfFile => Eof(&self.v[..]),
_ => ProducerError(0)
}
},
@ -96,9 +96,9 @@ impl Producer for FileProducer {
//println!("read: {} bytes\ndata:\n{}", n, (&self.v).to_hex(8));
self.v.truncate(n);
if n == 0 {
Eof(&self.v[])
Eof(&self.v[..])
} else {
Data(&self.v[])
Data(&self.v[..])
}
}
}