summaryrefslogtreecommitdiffstats
path: root/vendor/zip/examples
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/zip/examples')
-rw-r--r--vendor/zip/examples/extract.rs6
-rw-r--r--vendor/zip/examples/extract_lorem.rs4
-rw-r--r--vendor/zip/examples/file_info.rs4
-rw-r--r--vendor/zip/examples/stdin_info.rs4
-rw-r--r--vendor/zip/examples/write_dir.rs12
-rw-r--r--vendor/zip/examples/write_sample.rs6
6 files changed, 18 insertions, 18 deletions
diff --git a/vendor/zip/examples/extract.rs b/vendor/zip/examples/extract.rs
index 7b8860ca0..308071626 100644
--- a/vendor/zip/examples/extract.rs
+++ b/vendor/zip/examples/extract.rs
@@ -12,7 +12,7 @@ fn real_main() -> i32 {
return 1;
}
let fname = std::path::Path::new(&*args[1]);
- let file = fs::File::open(&fname).unwrap();
+ let file = fs::File::open(fname).unwrap();
let mut archive = zip::ZipArchive::new(file).unwrap();
@@ -26,7 +26,7 @@ fn real_main() -> i32 {
{
let comment = file.comment();
if !comment.is_empty() {
- println!("File {} comment: {}", i, comment);
+ println!("File {i} comment: {comment}");
}
}
@@ -42,7 +42,7 @@ fn real_main() -> i32 {
);
if let Some(p) = outpath.parent() {
if !p.exists() {
- fs::create_dir_all(&p).unwrap();
+ fs::create_dir_all(p).unwrap();
}
}
let mut outfile = fs::File::create(&outpath).unwrap();
diff --git a/vendor/zip/examples/extract_lorem.rs b/vendor/zip/examples/extract_lorem.rs
index a34a04f43..bc50abe16 100644
--- a/vendor/zip/examples/extract_lorem.rs
+++ b/vendor/zip/examples/extract_lorem.rs
@@ -11,7 +11,7 @@ fn real_main() -> i32 {
return 1;
}
let fname = std::path::Path::new(&*args[1]);
- let zipfile = std::fs::File::open(&fname).unwrap();
+ let zipfile = std::fs::File::open(fname).unwrap();
let mut archive = zip::ZipArchive::new(zipfile).unwrap();
@@ -25,7 +25,7 @@ fn real_main() -> i32 {
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
- println!("{}", contents);
+ println!("{contents}");
0
}
diff --git a/vendor/zip/examples/file_info.rs b/vendor/zip/examples/file_info.rs
index 64969b66c..6a2adc58e 100644
--- a/vendor/zip/examples/file_info.rs
+++ b/vendor/zip/examples/file_info.rs
@@ -12,7 +12,7 @@ fn real_main() -> i32 {
return 1;
}
let fname = std::path::Path::new(&*args[1]);
- let file = fs::File::open(&fname).unwrap();
+ let file = fs::File::open(fname).unwrap();
let reader = BufReader::new(file);
let mut archive = zip::ZipArchive::new(reader).unwrap();
@@ -30,7 +30,7 @@ fn real_main() -> i32 {
{
let comment = file.comment();
if !comment.is_empty() {
- println!("Entry {} comment: {}", i, comment);
+ println!("Entry {i} comment: {comment}");
}
}
diff --git a/vendor/zip/examples/stdin_info.rs b/vendor/zip/examples/stdin_info.rs
index 10d7aa8b8..a609916a0 100644
--- a/vendor/zip/examples/stdin_info.rs
+++ b/vendor/zip/examples/stdin_info.rs
@@ -20,12 +20,12 @@ fn real_main() -> i32 {
);
match file.read(&mut buf) {
Ok(n) => println!("The first {} bytes are: {:?}", n, &buf[0..n]),
- Err(e) => println!("Could not read the file: {:?}", e),
+ Err(e) => println!("Could not read the file: {e:?}"),
};
}
Ok(None) => break,
Err(e) => {
- println!("Error encountered while reading zip: {:?}", e);
+ println!("Error encountered while reading zip: {e:?}");
return 1;
}
}
diff --git a/vendor/zip/examples/write_dir.rs b/vendor/zip/examples/write_dir.rs
index 8cc561ffb..3b043528f 100644
--- a/vendor/zip/examples/write_dir.rs
+++ b/vendor/zip/examples/write_dir.rs
@@ -54,8 +54,8 @@ fn real_main() -> i32 {
continue;
}
match doit(src_dir, dst_file, method.unwrap()) {
- Ok(_) => println!("done: {} written to {}", src_dir, dst_file),
- Err(e) => println!("Error: {:?}", e),
+ Ok(_) => println!("done: {src_dir} written to {dst_file}"),
+ Err(e) => println!("Error: {e:?}"),
}
}
@@ -84,18 +84,18 @@ where
// Write file or directory explicitly
// Some unzip tools unzip files with directory paths correctly, some do not!
if path.is_file() {
- println!("adding file {:?} as {:?} ...", path, name);
+ println!("adding file {path:?} as {name:?} ...");
#[allow(deprecated)]
zip.start_file_from_path(name, options)?;
let mut f = File::open(path)?;
f.read_to_end(&mut buffer)?;
- zip.write_all(&*buffer)?;
+ zip.write_all(&buffer)?;
buffer.clear();
} else if !name.as_os_str().is_empty() {
// Only if not root! Avoids path spec / warning
// and mapname conversion failed error on unzip
- println!("adding dir {:?} as {:?} ...", path, name);
+ println!("adding dir {path:?} as {name:?} ...");
#[allow(deprecated)]
zip.add_directory_from_path(name, options)?;
}
@@ -114,7 +114,7 @@ fn doit(
}
let path = Path::new(dst_file);
- let file = File::create(&path).unwrap();
+ let file = File::create(path).unwrap();
let walkdir = WalkDir::new(src_dir);
let it = walkdir.into_iter();
diff --git a/vendor/zip/examples/write_sample.rs b/vendor/zip/examples/write_sample.rs
index b5749509e..2e45cb1ea 100644
--- a/vendor/zip/examples/write_sample.rs
+++ b/vendor/zip/examples/write_sample.rs
@@ -14,8 +14,8 @@ fn real_main() -> i32 {
let filename = &*args[1];
match doit(filename) {
- Ok(_) => println!("File written to {}", filename),
- Err(e) => println!("Error: {:?}", e),
+ Ok(_) => println!("File written to {filename}"),
+ Err(e) => println!("Error: {e:?}"),
}
0
@@ -23,7 +23,7 @@ fn real_main() -> i32 {
fn doit(filename: &str) -> zip::result::ZipResult<()> {
let path = std::path::Path::new(filename);
- let file = std::fs::File::create(&path).unwrap();
+ let file = std::fs::File::create(path).unwrap();
let mut zip = zip::ZipWriter::new(file);