Update tests to change all `&expr[]` to `&expr[..]` to make sure pretty printing
passes.
if let &Some(ref e) = start {
try!(self.print_expr(&**e));
}
- if start.is_some() || end.is_some() {
- try!(word(&mut self.s, ".."));
- }
+ try!(word(&mut self.s, ".."));
if let &Some(ref e) = end {
try!(self.print_expr(&**e));
}
fn nextc(&mut self) -> u8 {
let r = self.rng(1.0);
- for a in &self.lookup[] {
+ for a in &self.lookup[..] {
if a.p >= r {
return a.c;
}
let foo = Foo { bar: [1u8, 2, 3, 4, 5], baz: 10i32 };
unsafe {
let oof: Oof<[u8; 5], i32> = mem::transmute(foo);
- println!("{:?} {:?}", &oof.rab[], oof.zab);
+ println!("{:?} {:?}", &oof.rab[..], oof.zab);
}
}
let mut rbml_w = EBwriter::Encoder::new(&mut wr);
a1.encode(&mut rbml_w);
- let d: serialize::rbml::Doc<'a> = EBDoc::new(&wr[]);
+ let d: serialize::rbml::Doc<'a> = EBDoc::new(&wr);
let mut decoder: EBReader::Decoder<'a> = EBreader::Decoder::new(d);
let a2: A = Decodable::decode(&mut decoder);
assert!(*a1 == a2);
fn use_slice_mut(_: &mut [u8]) {}
fn use_vec(mut v: Vec<u8>) {
- use_slice_mut(&mut v[]); // what you have to write today
- use_slice_mut(&mut v); // what you'd be able to write
+ use_slice_mut(&mut v[..]); // what you have to write today
+ use_slice_mut(&mut v); // what you'd be able to write
use_slice_mut(&mut &mut &mut v);
- use_slice(&v[]); // what you have to write today
+ use_slice(&v[..]); // what you have to write today
use_slice(&v); // what you'd be able to write
use_slice(&&&&&&v);
use_slice(&mut &&&&&v);
}
fn use_vec_ref(v: &Vec<u8>) {
- use_slice(&v[]); // what you have to write today
+ use_slice(&v[..]); // what you have to write today
use_slice(v); // what you'd be able to write
use_slice(&&&&&&v);
use_slice(&mut &&&&&v);
let mut w = Vec::new();
let mut e = Encoder::new(&mut w);
obj.encode(&mut e);
- let doc = rbml::Doc::new(&w[]);
+ let doc = rbml::Doc::new(&w);
let mut dec = Decoder::new(doc);
let obj2 = Decodable::decode(&mut dec);
assert!(obj == obj2);
pub fn main() {
let x = [1; 100];
let mut y = 0;
- for i in &x[] {
+ for i in &x[..] {
if y > 10 {
break;
}
let y = [2; 100];
let mut p = 0;
let mut q = 0;
- for i in &x[] {
- for j in &y[] {
+ for i in &x[..] {
+ for j in &y[..] {
p += *j;
}
q += *i + p;
pub fn main() {
let x = [1; 100];
let mut y = 0;
- for i in &x[] {
+ for i in &x[..] {
y += *i
}
assert!(y == 100);
let x = [(), ()];
let slice = &x[..1];
- assert_repr_eq(&abc[], "[1, 2, 3]".to_string());
- assert_repr_eq(&tf[], "[true, false]".to_string());
- assert_repr_eq(&x[], "[(), ()]".to_string());
+ assert_repr_eq(&abc[..], "[1, 2, 3]".to_string());
+ assert_repr_eq(&tf[..], "[true, false]".to_string());
+ assert_repr_eq(&x[..], "[(), ()]".to_string());
assert_repr_eq(slice, "[()]".to_string());
- assert_repr_eq(&x[], "[(), ()]".to_string());
+ assert_repr_eq(&x[..], "[(), ()]".to_string());
}
let y = [ 0; 1 ];
print!("[");
- for xi in &x[] {
- print!("{:?}, ", &xi[]);
+ for xi in &x[..] {
+ print!("{:?}, ", &xi[..]);
}
println!("]");
- println!("{:?}", &y[]);
+ println!("{:?}", &y[..]);
}
fn main() {
let x: &[int] = &[1, 2, 3, 4, 5];
let cmp: &[int] = &[1, 2, 3, 4, 5];
- assert!(&x[] == cmp);
assert!(&x[..] == cmp);
let cmp: &[int] = &[3, 4, 5];
assert!(&x[2..] == cmp);
let x: Vec<int> = vec![1, 2, 3, 4, 5];
let cmp: &[int] = &[1, 2, 3, 4, 5];
- assert!(&x[] == cmp);
+ assert!(&x[..] == cmp);
let cmp: &[int] = &[3, 4, 5];
assert!(&x[2..] == cmp);
let cmp: &[int] = &[1, 2, 3];
let x: &mut [int] = &mut [1, 2, 3, 4, 5];
{
let cmp: &mut [int] = &mut [1, 2, 3, 4, 5];
- assert!(&mut x[] == cmp);
assert!(&mut x[..] == cmp);
}
{
let mut x: Vec<int> = vec![1, 2, 3, 4, 5];
{
let cmp: &mut [int] = &mut [1, 2, 3, 4, 5];
- assert!(&mut x[] == cmp);
assert!(&mut x[..] == cmp);
}
{
fn main() {
let mut x = Foo;
- &x[];
+ &x[..];
&x[Foo..];
&x[..Foo];
&x[Foo..Foo];
- &mut x[];
+ &mut x[..];
&mut x[Foo..];
&mut x[..Foo];
&mut x[Foo..Foo];