Skip to content

Commit a4c87f5

Browse files
Use dep syntax with getopts (#591)
By using `dep:getopts`, there isn't a need to rename the package to `getopts_dep`. Co-authored-by: Moritz Hoffmann <antiguru@gmail.com>
1 parent 6bba5fe commit a4c87f5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

timely/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ license = "MIT"
1616

1717
[features]
1818
default = ["getopts"]
19-
getopts = ["getopts-dep", "timely_communication/getopts"]
19+
getopts = ["dep:getopts", "timely_communication/getopts"]
2020

2121
[dependencies]
2222
columnar = { workspace = true }
2323
columnation = "0.1"
24-
getopts-dep = { package = "getopts", version = "0.2.21", optional = true }
24+
getopts = { version = "0.2.21", optional = true }
2525
bincode = { version = "1.0" }
2626
byteorder = "1.5"
2727
serde = { version = "1.0", features = ["derive"] }

timely/src/execute.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct Config {
1515
}
1616

1717
impl Config {
18-
/// Installs options into a [getopts_dep::Options] struct that correspond
18+
/// Installs options into a [getopts::Options] struct that correspond
1919
/// to the parameters in the configuration.
2020
///
2121
/// It is the caller's responsibility to ensure that the installed options
@@ -25,21 +25,21 @@ impl Config {
2525
/// This method is only available if the `getopts` feature is enabled, which
2626
/// it is by default.
2727
#[cfg(feature = "getopts")]
28-
pub fn install_options(opts: &mut getopts_dep::Options) {
28+
pub fn install_options(opts: &mut getopts::Options) {
2929
CommunicationConfig::install_options(opts);
3030
WorkerConfig::install_options(opts);
3131
}
3232

3333
/// Instantiates a configuration based upon the parsed options in `matches`.
3434
///
3535
/// The `matches` object must have been constructed from a
36-
/// [getopts_dep::Options] which contained at least the options installed by
36+
/// [getopts::Options] which contained at least the options installed by
3737
/// [Self::install_options].
3838
///
3939
/// This method is only available if the `getopts` feature is enabled, which
4040
/// it is by default.
4141
#[cfg(feature = "getopts")]
42-
pub fn from_matches(matches: &getopts_dep::Matches) -> Result<Config, String> {
42+
pub fn from_matches(matches: &getopts::Matches) -> Result<Config, String> {
4343
Ok(Config {
4444
communication: CommunicationConfig::from_matches(matches)?,
4545
worker: WorkerConfig::from_matches(matches)?,
@@ -51,7 +51,7 @@ impl Config {
5151
/// Most commonly, callers supply `std::env::args()` as the iterator.
5252
#[cfg(feature = "getopts")]
5353
pub fn from_args<I: Iterator<Item=String>>(args: I) -> Result<Config, String> {
54-
let mut opts = getopts_dep::Options::new();
54+
let mut opts = getopts::Options::new();
5555
Config::install_options(&mut opts);
5656
let matches = opts.parse(args).map_err(|e| e.to_string())?;
5757
Config::from_matches(&matches)

timely/src/worker.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct Config {
8787
}
8888

8989
impl Config {
90-
/// Installs options into a [getopts_dep::Options] struct that correspond
90+
/// Installs options into a [getopts::Options] struct that correspond
9191
/// to the parameters in the configuration.
9292
///
9393
/// It is the caller's responsibility to ensure that the installed options
@@ -97,20 +97,20 @@ impl Config {
9797
/// This method is only available if the `getopts` feature is enabled, which
9898
/// it is by default.
9999
#[cfg(feature = "getopts")]
100-
pub fn install_options(opts: &mut getopts_dep::Options) {
100+
pub fn install_options(opts: &mut getopts::Options) {
101101
opts.optopt("", "progress-mode", "progress tracking mode (eager or demand)", "MODE");
102102
}
103103

104104
/// Instantiates a configuration based upon the parsed options in `matches`.
105105
///
106106
/// The `matches` object must have been constructed from a
107-
/// [getopts_dep::Options] which contained at least the options installed by
107+
/// [getopts::Options] which contained at least the options installed by
108108
/// [Self::install_options].
109109
///
110110
/// This method is only available if the `getopts` feature is enabled, which
111111
/// it is by default.
112112
#[cfg(feature = "getopts")]
113-
pub fn from_matches(matches: &getopts_dep::Matches) -> Result<Config, String> {
113+
pub fn from_matches(matches: &getopts::Matches) -> Result<Config, String> {
114114
let progress_mode = matches
115115
.opt_get_default("progress-mode", ProgressMode::Eager)?;
116116
Ok(Config::default().progress_mode(progress_mode))

0 commit comments

Comments
 (0)