diff --git a/src/consumer.rs b/src/consumer.rs index ae66d7b..e488b8d 100644 --- a/src/consumer.rs +++ b/src/consumer.rs @@ -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); }, diff --git a/src/map.rs b/src/map.rs index d06cf09..f07aef7 100644 --- a/src/map.rs +++ b/src/map.rs @@ -537,7 +537,7 @@ mod tests { #[test] fn t1() { let v1:Vec = vec![1,2,3]; - let res = local_print(&v1[]); - assert_eq!(res, Done(&v1[], ())); + let res = local_print(&v1[..]); + assert_eq!(res, Done(&v1[..], ())); } } diff --git a/src/nom.rs b/src/nom.rs index 515b07f..6c41e44 100644 --- a/src/nom.rs +++ b/src/nom.rs @@ -840,18 +840,18 @@ mod tests { fn buffer_with_size() { let i:Vec = vec![7,8]; let o:Vec = 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 = vec![1,2,3]; let v2:Vec = 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 = 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); diff --git a/src/producer.rs b/src/producer.rs index 82687e3..8fb1ed3 100644 --- a/src/producer.rs +++ b/src/producer.rs @@ -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[..]) } } }