From 522039a70dfde59277edfd5dd933fcb80781d6fe Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Sun, 1 Mar 2015 12:01:39 +0100 Subject: [PATCH] Use the correct start index for iteration --- examples/extract.rs | 2 +- src/read.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/extract.rs b/examples/extract.rs index 38f8ca55..706a0660 100644 --- a/examples/extract.rs +++ b/examples/extract.rs @@ -18,7 +18,7 @@ fn main() let mut archive = zip::ZipArchive::new(file).unwrap(); - for i in 1..archive.len() + for i in 0..archive.len() { let mut file = archive.by_index(i).unwrap(); let outpath = sanitize_filename(file.name()); diff --git a/src/read.rs b/src/read.rs index db2abcee..4e3845f7 100644 --- a/src/read.rs +++ b/src/read.rs @@ -29,7 +29,7 @@ use types::ZipFileData; /// /// let mut zip = try!(zip::ZipArchive::new(reader)); /// -/// for i in 1..zip.len() +/// for i in 0..zip.len() /// { /// let mut file = zip.by_index(i).unwrap(); /// println!("Filename: {}", file.name()); @@ -96,7 +96,7 @@ impl ZipArchive /// fn iter() { /// let mut zip = zip::ZipArchive::new(std::io::Cursor::new(vec![])).unwrap(); /// - /// for i in 1..zip.len() { + /// for i in 0..zip.len() { /// let mut file = zip.by_index(i).unwrap(); /// // Do something with file i /// }