diff options
| author | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2015-02-23 00:20:42 +0200 |
|---|---|---|
| committer | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2015-02-23 00:20:42 +0200 |
| commit | 23fe16eab18f7fa7fe7e91a2ff7c7c712cff4bfc (patch) | |
| tree | e77337fa54aa932ae48a89846a45429ca1d2fae6 /src/rustbook | |
| parent | dcc6ce2c772cb851ac35cbc2ddafcae9bf2fa9fd (diff) | |
| download | rust-23fe16eab18f7fa7fe7e91a2ff7c7c712cff4bfc.tar.gz rust-23fe16eab18f7fa7fe7e91a2ff7c7c712cff4bfc.zip | |
rustbook: update slicing syntax where [] --> [..]
Diffstat (limited to 'src/rustbook')
| -rw-r--r-- | src/rustbook/book.rs | 8 | ||||
| -rw-r--r-- | src/rustbook/build.rs | 8 | ||||
| -rw-r--r-- | src/rustbook/main.rs | 6 | ||||
| -rw-r--r-- | src/rustbook/test.rs | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/rustbook/book.rs b/src/rustbook/book.rs index 21f8a7793dc..3c116aa860b 100644 --- a/src/rustbook/book.rs +++ b/src/rustbook/book.rs @@ -50,14 +50,14 @@ impl<'a> Iterator for BookItems<'a> { let mut section = "".to_string(); for &(_, idx) in &self.stack { - section.push_str(&(idx + 1).to_string()[]); + section.push_str(&(idx + 1).to_string()[..]); section.push('.'); } - section.push_str(&(self.cur_idx + 1).to_string()[]); + section.push_str(&(self.cur_idx + 1).to_string()[..]); section.push('.'); self.stack.push((self.cur_items, self.cur_idx)); - self.cur_items = &cur.children[]; + self.cur_items = &cur.children[..]; self.cur_idx = 0; return Some((section, cur)) } @@ -68,7 +68,7 @@ impl<'a> Iterator for BookItems<'a> { impl Book { pub fn iter(&self) -> BookItems { BookItems { - cur_items: &self.chapters[], + cur_items: &self.chapters[..], cur_idx: 0, stack: Vec::new(), } diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs index 224f1ef1a8b..2283b06d5d5 100644 --- a/src/rustbook/build.rs +++ b/src/rustbook/build.rs @@ -41,7 +41,7 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()> path_to_root: &Path, out: &mut Writer) -> IoResult<()> { for (i, item) in items.iter().enumerate() { - try!(walk_item(item, &format!("{}{}.", section, i + 1)[], path_to_root, out)); + try!(walk_item(item, &format!("{}{}.", section, i + 1)[..], path_to_root, out)); } Ok(()) } @@ -55,7 +55,7 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()> item.title)); if !item.children.is_empty() { try!(writeln!(out, "<ul class='section'>")); - let _ = walk_items(&item.children[], section, path_to_root, out); + let _ = walk_items(&item.children[..], section, path_to_root, out); try!(writeln!(out, "</ul>")); } try!(writeln!(out, "</li>")); @@ -65,7 +65,7 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()> try!(writeln!(out, "<div id='toc' class='mobile-hidden'>")); try!(writeln!(out, "<ul class='chapter'>")); - try!(walk_items(&book.chapters[], "", path_to_root, out)); + try!(walk_items(&book.chapters[..], "", path_to_root, out)); try!(writeln!(out, "</ul>")); try!(writeln!(out, "</div>")); @@ -179,7 +179,7 @@ impl Subcommand for Build { Err(errors) => { let n = errors.len(); for err in errors { - term.err(&format!("error: {}", err)[]); + term.err(&format!("error: {}", err)[..]); } Err(box format!("{} errors occurred", n) as Box<Error>) diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index ace57f0ac2c..e21b2ff178e 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -54,16 +54,16 @@ fn main() { if cmd.len() <= 1 { help::usage() } else { - match subcommand::parse_name(&cmd[1][]) { + match subcommand::parse_name(&cmd[1][..]) { Some(mut subcmd) => { match subcmd.parse_args(cmd.tail()) { Ok(_) => { match subcmd.execute(&mut term) { Ok(_) => (), Err(err) => { - term.err(&format!("error: {}", err.description())[]); + term.err(&format!("error: {}", err.description())[..]); err.detail().map(|detail| { - term.err(&format!("detail: {}", detail)[]); + term.err(&format!("detail: {}", detail)[..]); }); } } diff --git a/src/rustbook/test.rs b/src/rustbook/test.rs index c5d4875423a..727a385a8f0 100644 --- a/src/rustbook/test.rs +++ b/src/rustbook/test.rs @@ -50,8 +50,8 @@ impl Subcommand for Test { Ok(output) => { if !output.status.success() { term.err(&format!("{}\n{}", - String::from_utf8_lossy(&output.output[]), - String::from_utf8_lossy(&output.error[]))[]); + String::from_utf8_lossy(&output.output[..]), + String::from_utf8_lossy(&output.error[..]))[..]); return Err(box "Some tests failed." as Box<Error>); } |
