diff options
Diffstat (limited to 'src/tools/rust-analyzer/xtask')
-rw-r--r-- | src/tools/rust-analyzer/xtask/Cargo.toml | 4 | ||||
-rw-r--r-- | src/tools/rust-analyzer/xtask/src/flags.rs | 19 | ||||
-rw-r--r-- | src/tools/rust-analyzer/xtask/src/main.rs | 7 |
3 files changed, 10 insertions, 20 deletions
diff --git a/src/tools/rust-analyzer/xtask/Cargo.toml b/src/tools/rust-analyzer/xtask/Cargo.toml index 95d44e9b9..0be0bf920 100644 --- a/src/tools/rust-analyzer/xtask/Cargo.toml +++ b/src/tools/rust-analyzer/xtask/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" rust-version = "1.57" [dependencies] -anyhow = "1.0.57" +anyhow = "1.0.62" flate2 = "1.0.24" write-json = "0.1.2" xshell = "0.2.2" -xflags = "0.2.4" +xflags = "0.3.0" # Avoid adding more dependencies to this crate diff --git a/src/tools/rust-analyzer/xtask/src/flags.rs b/src/tools/rust-analyzer/xtask/src/flags.rs index 993c64cce..0fce48898 100644 --- a/src/tools/rust-analyzer/xtask/src/flags.rs +++ b/src/tools/rust-analyzer/xtask/src/flags.rs @@ -7,10 +7,6 @@ xflags::xflags! { /// Run custom build command. cmd xtask { - default cmd help { - /// Print help information. - optional -h, --help - } /// Install rust-analyzer server or editor plugin. cmd install { @@ -42,9 +38,9 @@ xflags::xflags! { optional --dry-run } /// Builds a benchmark version of rust-analyzer and puts it into `./target`. - cmd bb + cmd bb { required suffix: String - {} + } } } @@ -58,7 +54,6 @@ pub struct Xtask { #[derive(Debug)] pub enum XtaskCmd { - Help(Help), Install(Install), FuzzTests(FuzzTests), Release(Release), @@ -69,11 +64,6 @@ pub enum XtaskCmd { } #[derive(Debug)] -pub struct Help { - pub help: bool, -} - -#[derive(Debug)] pub struct Install { pub client: bool, pub code_bin: Option<String>, @@ -111,7 +101,10 @@ pub struct Bb { } impl Xtask { - pub const HELP: &'static str = Self::HELP_; + #[allow(dead_code)] + pub fn from_env_or_exit() -> Self { + Self::from_env_or_exit_() + } #[allow(dead_code)] pub fn from_env() -> xflags::Result<Self> { diff --git a/src/tools/rust-analyzer/xtask/src/main.rs b/src/tools/rust-analyzer/xtask/src/main.rs index 335ac324a..a37f469ad 100644 --- a/src/tools/rust-analyzer/xtask/src/main.rs +++ b/src/tools/rust-analyzer/xtask/src/main.rs @@ -25,15 +25,12 @@ use std::{ use xshell::{cmd, Shell}; fn main() -> anyhow::Result<()> { + let flags = flags::Xtask::from_env_or_exit(); + let sh = &Shell::new()?; sh.change_dir(project_root()); - let flags = flags::Xtask::from_env()?; match flags.subcommand { - flags::XtaskCmd::Help(_) => { - println!("{}", flags::Xtask::HELP); - Ok(()) - } flags::XtaskCmd::Install(cmd) => cmd.run(sh), flags::XtaskCmd::FuzzTests(_) => run_fuzzer(sh), flags::XtaskCmd::Release(cmd) => cmd.run(sh), |