From 0296cd590e4c0a21f75b7ec7b420d849c7e9588e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 6 Mar 2021 23:02:06 +0300 Subject: :arrow_up: xflags --- Cargo.lock | 8 ++++---- crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/bin/flags.rs | 15 ++++++++------- xtask/Cargo.toml | 2 +- xtask/src/flags.rs | 17 +++++++++-------- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39f27098a..c392a8907 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1919,18 +1919,18 @@ checksum = "06069a848f95fceae3e5e03c0ddc8cb78452b56654ee0c8e68f938cf790fb9e3" [[package]] name = "xflags" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222e914b43cec5d7305ac5116d10a14b3a52c50e9062d642c92631f3beabc729" +checksum = "59ad6ce6a0b7224130015b4ebac796478ac04e0079f5d222a690efea06a9208a" dependencies = [ "xflags-macros", ] [[package]] name = "xflags-macros" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f18f5b4aa7f95e209d5b9274f6164c3938920b4d5c75f97f0dd16daee25ddd" +checksum = "c8037d3ca14996158b03c0fa905d0834906ef0fc7044df72c1f5ff690e5e62c9" dependencies = [ "proc-macro2", ] diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 8789f0852..3130785cc 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -24,7 +24,7 @@ jod-thread = "0.1.0" log = "0.4.8" lsp-types = { version = "0.88.0", features = ["proposed"] } parking_lot = "0.11.0" -xflags = "0.1.2" +xflags = "0.2.1" oorandom = "11.1.2" rustc-hash = "1.1.0" serde = { version = "1.0.106", features = ["derive"] } diff --git a/crates/rust-analyzer/src/bin/flags.rs b/crates/rust-analyzer/src/bin/flags.rs index 244912d26..3a7caaf3f 100644 --- a/crates/rust-analyzer/src/bin/flags.rs +++ b/crates/rust-analyzer/src/bin/flags.rs @@ -6,7 +6,9 @@ use ide_ssr::{SsrPattern, SsrRule}; use rust_analyzer::cli::{BenchWhat, Position, Verbosity}; use vfs::AbsPathBuf; -xflags::args_parser! { +xflags::xflags! { + src "./src/bin/flags.rs" + /// LSP server for the Rust programming language. cmd rust-analyzer { /// Verbosity level, can be repeated multiple times. @@ -120,7 +122,7 @@ xflags::args_parser! { // generated start // The following code is generated by `xflags` macro. -// Run `env XFLAGS_DUMP= cargo build` to regenerate. +// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate. #[derive(Debug)] pub struct RustAnalyzer { pub verbose: u32, @@ -158,7 +160,7 @@ pub struct Parse { } #[derive(Debug)] -pub struct Symbols {} +pub struct Symbols; #[derive(Debug)] pub struct Highlight { @@ -211,14 +213,13 @@ pub struct Search { } #[derive(Debug)] -pub struct ProcMacro {} +pub struct ProcMacro; impl RustAnalyzer { - pub const HELP: &'static str = Self::_HELP; + pub const HELP: &'static str = Self::HELP_; pub fn from_env() -> xflags::Result { - let mut p = xflags::rt::Parser::new_from_env(); - Self::_parse(&mut p) + Self::from_env_() } } // generated end diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b17dde598..e084f0df6 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -15,5 +15,5 @@ ungrammar = "=1.11" walkdir = "2.3.1" write-json = "0.1.0" xshell = "0.1" -xflags = "0.1.2" +xflags = "0.2.1" # Avoid adding more dependencies to this crate diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs index 56eda5b1e..b39d937ca 100644 --- a/xtask/src/flags.rs +++ b/xtask/src/flags.rs @@ -2,7 +2,9 @@ use crate::install::{ClientOpt, Malloc, ServerOpt}; -xflags::args_parser! { +xflags::xflags! { + src "./src/flags.rs" + /// Run custom build command. cmd xtask { default cmd help { @@ -55,7 +57,7 @@ xflags::args_parser! { // generated start // The following code is generated by `xflags` macro. -// Run `env XFLAGS_DUMP= cargo build` to regenerate. +// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate. #[derive(Debug)] pub struct Xtask { pub subcommand: XtaskCmd, @@ -96,13 +98,13 @@ pub struct Codegen { } #[derive(Debug)] -pub struct Lint {} +pub struct Lint; #[derive(Debug)] -pub struct FuzzTests {} +pub struct FuzzTests; #[derive(Debug)] -pub struct PreCache {} +pub struct PreCache; #[derive(Debug)] pub struct Release { @@ -131,11 +133,10 @@ pub struct Bb { } impl Xtask { - pub const HELP: &'static str = Self::_HELP; + pub const HELP: &'static str = Self::HELP_; pub fn from_env() -> xflags::Result { - let mut p = xflags::rt::Parser::new_from_env(); - Self::_parse(&mut p) + Self::from_env_() } } // generated end -- cgit v1.2.3