Skip to content

Commit 06c58cb

Browse files
committed
Auto merge of rust-lang#112884 - klensy:ri-drop-old-clap, r=albertlarsan68
rust-installer: migrate to clap 4.2, change to 2021 edition and fix few clippy lints Updated rust-installer to clap 4.2, dropping last user of clap v3; changes to 2021 edition, fixes few clippy warns.
2 parents ae8ffa6 + fd1439e commit 06c58cb

File tree

8 files changed

+57
-132
lines changed

8 files changed

+57
-132
lines changed

Cargo.lock

+10-85
Original file line numberDiff line numberDiff line change
@@ -480,31 +480,14 @@ dependencies = [
480480
"winapi",
481481
]
482482

483-
[[package]]
484-
name = "clap"
485-
version = "3.2.20"
486-
source = "registry+https://github.com/rust-lang/crates.io-index"
487-
checksum = "23b71c3ce99b7611011217b366d923f1d0a7e07a92bb2dbf1e84508c673ca3bd"
488-
dependencies = [
489-
"atty",
490-
"bitflags",
491-
"clap_derive 3.2.18",
492-
"clap_lex 0.2.2",
493-
"indexmap",
494-
"once_cell",
495-
"strsim",
496-
"termcolor",
497-
"textwrap",
498-
]
499-
500483
[[package]]
501484
name = "clap"
502485
version = "4.2.1"
503486
source = "registry+https://github.com/rust-lang/crates.io-index"
504487
checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3"
505488
dependencies = [
506489
"clap_builder",
507-
"clap_derive 4.2.0",
490+
"clap_derive",
508491
"once_cell",
509492
]
510493

@@ -517,7 +500,7 @@ dependencies = [
517500
"anstream",
518501
"anstyle",
519502
"bitflags",
520-
"clap_lex 0.4.1",
503+
"clap_lex",
521504
"once_cell",
522505
"strsim",
523506
"terminal_size",
@@ -529,20 +512,7 @@ version = "4.0.7"
529512
source = "registry+https://github.com/rust-lang/crates.io-index"
530513
checksum = "10861370d2ba66b0f5989f83ebf35db6421713fd92351790e7fdd6c36774c56b"
531514
dependencies = [
532-
"clap 4.2.1",
533-
]
534-
535-
[[package]]
536-
name = "clap_derive"
537-
version = "3.2.18"
538-
source = "registry+https://github.com/rust-lang/crates.io-index"
539-
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
540-
dependencies = [
541-
"heck",
542-
"proc-macro-error",
543-
"proc-macro2",
544-
"quote",
545-
"syn 1.0.102",
515+
"clap",
546516
]
547517

548518
[[package]]
@@ -557,15 +527,6 @@ dependencies = [
557527
"syn 2.0.8",
558528
]
559529

560-
[[package]]
561-
name = "clap_lex"
562-
version = "0.2.2"
563-
source = "registry+https://github.com/rust-lang/crates.io-index"
564-
checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613"
565-
dependencies = [
566-
"os_str_bytes",
567-
]
568-
569530
[[package]]
570531
name = "clap_lex"
571532
version = "0.4.1"
@@ -576,7 +537,7 @@ checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
576537
name = "clippy"
577538
version = "0.1.72"
578539
dependencies = [
579-
"clap 4.2.1",
540+
"clap",
580541
"clippy_lints",
581542
"clippy_utils",
582543
"compiletest_rs",
@@ -605,7 +566,7 @@ name = "clippy_dev"
605566
version = "0.0.1"
606567
dependencies = [
607568
"aho-corasick",
608-
"clap 4.2.1",
569+
"clap",
609570
"indoc",
610571
"itertools",
611572
"opener",
@@ -1749,7 +1710,7 @@ name = "installer"
17491710
version = "0.0.0"
17501711
dependencies = [
17511712
"anyhow",
1752-
"clap 3.2.20",
1713+
"clap",
17531714
"flate2",
17541715
"num_cpus",
17551716
"rayon",
@@ -1869,7 +1830,7 @@ name = "jsondoclint"
18691830
version = "0.1.0"
18701831
dependencies = [
18711832
"anyhow",
1872-
"clap 4.2.1",
1833+
"clap",
18731834
"fs-err",
18741835
"rustc-hash",
18751836
"rustdoc-json-types",
@@ -2086,7 +2047,7 @@ dependencies = [
20862047
"ammonia",
20872048
"anyhow",
20882049
"chrono",
2089-
"clap 4.2.1",
2050+
"clap",
20902051
"clap_complete",
20912052
"elasticlunr-rs",
20922053
"env_logger 0.10.0",
@@ -2370,12 +2331,6 @@ dependencies = [
23702331
"vcpkg",
23712332
]
23722333

2373-
[[package]]
2374-
name = "os_str_bytes"
2375-
version = "6.0.0"
2376-
source = "registry+https://github.com/rust-lang/crates.io-index"
2377-
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
2378-
23792334
[[package]]
23802335
name = "owo-colors"
23812336
version = "3.5.0"
@@ -2617,30 +2572,6 @@ version = "0.1.1"
26172572
source = "registry+https://github.com/rust-lang/crates.io-index"
26182573
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
26192574

2620-
[[package]]
2621-
name = "proc-macro-error"
2622-
version = "1.0.4"
2623-
source = "registry+https://github.com/rust-lang/crates.io-index"
2624-
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
2625-
dependencies = [
2626-
"proc-macro-error-attr",
2627-
"proc-macro2",
2628-
"quote",
2629-
"syn 1.0.102",
2630-
"version_check",
2631-
]
2632-
2633-
[[package]]
2634-
name = "proc-macro-error-attr"
2635-
version = "1.0.4"
2636-
source = "registry+https://github.com/rust-lang/crates.io-index"
2637-
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
2638-
dependencies = [
2639-
"proc-macro2",
2640-
"quote",
2641-
"version_check",
2642-
]
2643-
26442575
[[package]]
26452576
name = "proc-macro-hack"
26462577
version = "0.5.19"
@@ -2897,7 +2828,7 @@ dependencies = [
28972828
name = "rustbook"
28982829
version = "0.1.0"
28992830
dependencies = [
2900-
"clap 4.2.1",
2831+
"clap",
29012832
"env_logger 0.10.0",
29022833
"mdbook",
29032834
]
@@ -4346,7 +4277,7 @@ dependencies = [
43464277
"anyhow",
43474278
"bytecount",
43484279
"cargo_metadata",
4349-
"clap 4.2.1",
4280+
"clap",
43504281
"diff",
43514282
"dirs",
43524283
"env_logger 0.10.0",
@@ -4874,12 +4805,6 @@ dependencies = [
48744805
"term",
48754806
]
48764807

4877-
[[package]]
4878-
name = "textwrap"
4879-
version = "0.15.0"
4880-
source = "registry+https://github.com/rust-lang/crates.io-index"
4881-
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
4882-
48834808
[[package]]
48844809
name = "thin-vec"
48854810
version = "0.2.12"

src/tools/rust-installer/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "installer"
44
version = "0.0.0"
5-
edition = "2018"
5+
edition = "2021"
66

77
[[bin]]
88
doc = false
@@ -20,4 +20,4 @@ num_cpus = "1"
2020

2121
[dependencies.clap]
2222
features = ["derive"]
23-
version = "3.1"
23+
version = "4.2"

src/tools/rust-installer/src/combiner.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,47 @@ actor! {
1313
#[derive(Debug)]
1414
pub struct Combiner {
1515
/// The name of the product, for display.
16-
#[clap(value_name = "NAME")]
16+
#[arg(value_name = "NAME")]
1717
product_name: String = "Product",
1818

1919
/// The name of the package tarball.
20-
#[clap(value_name = "NAME")]
20+
#[arg(value_name = "NAME")]
2121
package_name: String = "package",
2222

2323
/// The directory under lib/ where the manifest lives.
24-
#[clap(value_name = "DIR")]
24+
#[arg(value_name = "DIR")]
2525
rel_manifest_dir: String = "packagelib",
2626

2727
/// The string to print after successful installation.
28-
#[clap(value_name = "MESSAGE")]
28+
#[arg(value_name = "MESSAGE")]
2929
success_message: String = "Installed.",
3030

3131
/// Places to look for legacy manifests to uninstall.
32-
#[clap(value_name = "DIRS")]
32+
#[arg(value_name = "DIRS")]
3333
legacy_manifest_dirs: String = "",
3434

3535
/// Installers to combine.
36-
#[clap(value_name = "FILE,FILE")]
36+
#[arg(value_name = "FILE,FILE")]
3737
input_tarballs: String = "",
3838

3939
/// Directory containing files that should not be installed.
40-
#[clap(value_name = "DIR")]
40+
#[arg(value_name = "DIR")]
4141
non_installed_overlay: String = "",
4242

4343
/// The directory to do temporary work.
44-
#[clap(value_name = "DIR")]
44+
#[arg(value_name = "DIR")]
4545
work_dir: String = "./workdir",
4646

4747
/// The location to put the final image and tarball.
48-
#[clap(value_name = "DIR")]
48+
#[arg(value_name = "DIR")]
4949
output_dir: String = "./dist",
5050

5151
/// The profile used to compress the tarball.
52-
#[clap(value_name = "FORMAT", default_value_t)]
52+
#[arg(value_name = "FORMAT", default_value_t)]
5353
compression_profile: CompressionProfile,
5454

5555
/// The formats used to compress the tarball
56-
#[clap(value_name = "FORMAT", default_value_t)]
56+
#[arg(value_name = "FORMAT", default_value_t)]
5757
compression_formats: CompressionFormats,
5858
}
5959
}
@@ -94,7 +94,7 @@ impl Combiner {
9494
let pkg_name =
9595
input_tarball.trim_end_matches(&format!(".tar.{}", compression.extension()));
9696
let pkg_name = Path::new(pkg_name).file_name().unwrap();
97-
let pkg_dir = Path::new(&self.work_dir).join(&pkg_name);
97+
let pkg_dir = Path::new(&self.work_dir).join(pkg_name);
9898

9999
// Verify the version number.
100100
let mut version = String::new();
@@ -114,9 +114,9 @@ impl Combiner {
114114
// All we need to do is copy the component directory. We could
115115
// move it, but rustbuild wants to reuse the unpacked package
116116
// dir for OS-specific installers on macOS and Windows.
117-
let component_dir = package_dir.join(&component);
117+
let component_dir = package_dir.join(component);
118118
create_dir(&component_dir)?;
119-
copy_recursive(&pkg_dir.join(&component), &component_dir)?;
119+
copy_recursive(&pkg_dir.join(component), &component_dir)?;
120120

121121
// Merge the component name.
122122
writeln!(&components, "{}", component).context("failed to write new components")?;
@@ -158,7 +158,7 @@ impl Combiner {
158158
.input(self.package_name)
159159
.output(path_to_str(&output)?.into())
160160
.compression_profile(self.compression_profile)
161-
.compression_formats(self.compression_formats.clone());
161+
.compression_formats(self.compression_formats);
162162
tarballer.run()?;
163163

164164
Ok(())

src/tools/rust-installer/src/compression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl Default for CompressionFormats {
166166

167167
impl CompressionFormats {
168168
pub(crate) fn iter(&self) -> impl Iterator<Item = CompressionFormat> + '_ {
169-
self.0.iter().map(|i| *i)
169+
self.0.iter().copied()
170170
}
171171
}
172172

src/tools/rust-installer/src/generator.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,55 @@ actor! {
1111
#[derive(Debug)]
1212
pub struct Generator {
1313
/// The name of the product, for display
14-
#[clap(value_name = "NAME")]
14+
#[arg(value_name = "NAME")]
1515
product_name: String = "Product",
1616

1717
/// The name of the component, distinct from other installed components
18-
#[clap(value_name = "NAME")]
18+
#[arg(value_name = "NAME")]
1919
component_name: String = "component",
2020

2121
/// The name of the package, tarball
22-
#[clap(value_name = "NAME")]
22+
#[arg(value_name = "NAME")]
2323
package_name: String = "package",
2424

2525
/// The directory under lib/ where the manifest lives
26-
#[clap(value_name = "DIR")]
26+
#[arg(value_name = "DIR")]
2727
rel_manifest_dir: String = "packagelib",
2828

2929
/// The string to print after successful installation
30-
#[clap(value_name = "MESSAGE")]
30+
#[arg(value_name = "MESSAGE")]
3131
success_message: String = "Installed.",
3232

3333
/// Places to look for legacy manifests to uninstall
34-
#[clap(value_name = "DIRS")]
34+
#[arg(value_name = "DIRS")]
3535
legacy_manifest_dirs: String = "",
3636

3737
/// Directory containing files that should not be installed
38-
#[clap(value_name = "DIR")]
38+
#[arg(value_name = "DIR")]
3939
non_installed_overlay: String = "",
4040

4141
/// Path prefixes of directories that should be installed/uninstalled in bulk
42-
#[clap(value_name = "DIRS")]
42+
#[arg(value_name = "DIRS")]
4343
bulk_dirs: String = "",
4444

4545
/// The directory containing the installation medium
46-
#[clap(value_name = "DIR")]
46+
#[arg(value_name = "DIR")]
4747
image_dir: String = "./install_image",
4848

4949
/// The directory to do temporary work
50-
#[clap(value_name = "DIR")]
50+
#[arg(value_name = "DIR")]
5151
work_dir: String = "./workdir",
5252

5353
/// The location to put the final image and tarball
54-
#[clap(value_name = "DIR")]
54+
#[arg(value_name = "DIR")]
5555
output_dir: String = "./dist",
5656

5757
/// The profile used to compress the tarball.
58-
#[clap(value_name = "FORMAT", default_value_t)]
58+
#[arg(value_name = "FORMAT", default_value_t)]
5959
compression_profile: CompressionProfile,
6060

6161
/// The formats used to compress the tarball
62-
#[clap(value_name = "FORMAT", default_value_t)]
62+
#[arg(value_name = "FORMAT", default_value_t)]
6363
compression_formats: CompressionFormats,
6464
}
6565
}
@@ -118,7 +118,7 @@ impl Generator {
118118
.input(self.package_name)
119119
.output(path_to_str(&output)?.into())
120120
.compression_profile(self.compression_profile)
121-
.compression_formats(self.compression_formats.clone());
121+
.compression_formats(self.compression_formats);
122122
tarballer.run()?;
123123

124124
Ok(())

0 commit comments

Comments
 (0)