Skip to content

Commit b02576d

Browse files
committed
Simplify
help for internal tools does not worth the duplication
1 parent 8f1792f commit b02576d

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

xtask/src/help.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ FLAGS:
2727
--jemalloc
2828
--server";
2929

30-
pub fn print_no_param_subcommand_help(subcommand: &str) {
31-
eprintln!(
32-
"ra_tools-{}
33-
34-
USAGE:
35-
ra_tools {}
36-
37-
FLAGS:
38-
-h, --help Prints help information",
39-
subcommand, subcommand
40-
);
41-
}
42-
4330
pub const INSTALL_RA_CONFLICT: &str =
4431
"error: The argument `--server` cannot be used with `--client-code`
4532

xtask/src/main.rs

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70,42 +70,14 @@ fn main() -> Result<()> {
7070
install(opts)?
7171
}
7272
"codegen" => {
73-
if matches.contains(["-h", "--help"]) {
74-
help::print_no_param_subcommand_help(&subcommand);
75-
return Ok(());
76-
}
7773
codegen::generate_syntax(Mode::Overwrite)?;
7874
codegen::generate_parser_tests(Mode::Overwrite)?;
7975
codegen::generate_assists_docs(Mode::Overwrite)?;
8076
}
81-
"format" => {
82-
if matches.contains(["-h", "--help"]) {
83-
help::print_no_param_subcommand_help(&subcommand);
84-
return Ok(());
85-
}
86-
run_rustfmt(Mode::Overwrite)?
87-
}
88-
"install-pre-commit-hook" => {
89-
if matches.contains(["-h", "--help"]) {
90-
help::print_no_param_subcommand_help(&subcommand);
91-
return Ok(());
92-
}
93-
install_pre_commit_hook()?
94-
}
95-
"lint" => {
96-
if matches.contains(["-h", "--help"]) {
97-
help::print_no_param_subcommand_help(&subcommand);
98-
return Ok(());
99-
}
100-
run_clippy()?
101-
}
102-
"fuzz-tests" => {
103-
if matches.contains(["-h", "--help"]) {
104-
help::print_no_param_subcommand_help(&subcommand);
105-
return Ok(());
106-
}
107-
run_fuzzer()?
108-
}
77+
"format" => run_rustfmt(Mode::Overwrite)?,
78+
"install-pre-commit-hook" => install_pre_commit_hook()?,
79+
"lint" => run_clippy()?,
80+
"fuzz-tests" => run_fuzzer()?,
10981
_ => eprintln!("{}", help::GLOBAL_HELP),
11082
}
11183
Ok(())

0 commit comments

Comments
 (0)