diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
commit | 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch) | |
tree | d325add32978dbdc1db975a438b3a77d571b1ab8 /vendor/zip/examples | |
parent | Releasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/zip/examples')
-rw-r--r-- | vendor/zip/examples/extract.rs | 6 | ||||
-rw-r--r-- | vendor/zip/examples/extract_lorem.rs | 4 | ||||
-rw-r--r-- | vendor/zip/examples/file_info.rs | 4 | ||||
-rw-r--r-- | vendor/zip/examples/stdin_info.rs | 4 | ||||
-rw-r--r-- | vendor/zip/examples/write_dir.rs | 12 | ||||
-rw-r--r-- | vendor/zip/examples/write_sample.rs | 6 |
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); |