get rid of structop and update clippy in common test, now only criterion is left with version 2

This commit is contained in:
Marcel Märtens 2023-05-05 00:11:43 +02:00
parent 4be1e82ba9
commit d90ea8c1da
11 changed files with 41 additions and 90 deletions

61
Cargo.lock generated
View File

@ -121,15 +121,6 @@ dependencies = [
"libc",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "anstream"
version = "0.3.2"
@ -739,13 +730,9 @@ version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
@ -778,7 +765,7 @@ version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
dependencies = [
"heck 0.4.1",
"heck",
"proc-macro2 1.0.56",
"quote 1.0.26",
"syn 2.0.15",
@ -2797,15 +2784,6 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.1"
@ -6231,12 +6209,6 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
version = "0.9.3"
@ -6249,30 +6221,6 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "structopt"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
dependencies = [
"clap 2.34.0",
"lazy_static",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck 0.3.3",
"proc-macro-error",
"proc-macro2 1.0.56",
"quote 1.0.26",
"syn 1.0.109",
]
[[package]]
name = "strum"
version = "0.24.1"
@ -6288,7 +6236,7 @@ version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
dependencies = [
"heck 0.4.1",
"heck",
"proc-macro2 1.0.56",
"quote 1.0.26",
"rustversion",
@ -6970,7 +6918,6 @@ dependencies = [
"rustyline",
"serde",
"specs",
"structopt",
"termcolor",
"tokio",
"tracing",
@ -7015,7 +6962,7 @@ dependencies = [
"cfg-if 1.0.0",
"chrono",
"chrono-tz",
"clap 2.34.0",
"clap 4.2.7",
"criterion",
"crossbeam-channel",
"crossbeam-utils 0.8.15",
@ -7045,7 +6992,6 @@ dependencies = [
"slotmap 1.0.6",
"specs",
"spin_sleep",
"structopt",
"strum",
"tracing",
"tracing-subscriber",
@ -7361,6 +7307,7 @@ dependencies = [
"serde",
"shell-words",
"signal-hook 0.3.15",
"strum",
"tokio",
"tracing",
"tui",

View File

@ -7,7 +7,7 @@ edition = "2021"
[features]
simd = ["vek/platform_intrinsics"]
plugins = ["common-state/plugins"]
bin_bot = ["common-ecs", "serde", "ron", "clap", "structopt", "rustyline", "common-frontend", "async-channel", "voxygen-i18n-helpers", "client-i18n"]
bin_bot = ["common-ecs", "serde", "ron", "clap", "rustyline", "common-frontend", "async-channel", "voxygen-i18n-helpers", "client-i18n"]
tracy = ["common-base/tracy"]
tick_network = []
@ -41,8 +41,7 @@ voxygen-i18n-helpers = { package = "veloren-voxygen-i18n-helpers", path = "../vo
client-i18n = { package = "veloren-client-i18n", path = "i18n", optional = true }
serde = { version = "1.0", features = [ "rc", "derive" ], optional = true }
ron = { version = "0.8", default-features = false, optional = true }
clap = { version = "4.2", optional = true, features = ["color", "std"] }
structopt = { version = "0.3.13", optional = true }
clap = { version = "4.2", optional = true }
rustyline = { version = "11.0.0", optional = true }
## logging
termcolor = { version = "1.1", optional = true }

View File

@ -21,7 +21,7 @@ hashbrown = { version = "0.13", features = ["serde", "nightly"] }
deunicode = "1.0"
tracing = "0.1"
# Bin
clap = { version = "4.2", features = ["suggestions", "std"], default-features = false, optional = true }
clap = { version = "4.2", features = ["suggestions", "std", "help", "usage", "error-context"], default-features = false, optional = true }
fluent-syntax = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
[[bin]]

View File

@ -26,12 +26,15 @@ impl Tui {
let handle = thread::spawn(move || {
thread::sleep(Duration::from_millis(20));
let mut readline =
rustyline::Editor::<(), rustyline::history::FileHistory>::with_history(
Default::default(),
Default::default(),
)
.unwrap();
let config = rustyline::config::Builder::new()
.max_history_size(1000)
.unwrap()
.build();
let mut readline = rustyline::Editor::<(), _>::with_history(
config,
rustyline::history::MemHistory::with_config(config),
)
.unwrap();
while let Ok(cmd) = readline.readline("\n\nbotclient> ") {
let keep_going = Self::process_command(&cmd, &mut commands_s);
readline.add_history_entry(cmd).unwrap();
@ -77,7 +80,7 @@ impl Tui {
Some(("register", matches)) => command_s.try_send(Cmd::Register {
prefix: matches.get_one::<String>("prefix").unwrap().to_string(),
password: matches.get_one::<String>("password").unwrap().to_string(),
count: matches.get_one::<usize>("count").cloned(),
count: matches.get_one::<usize>("count").copied(),
}),
Some(("login", matches)) => command_s.try_send(Cmd::Login {
prefix: matches.get_one::<String>("prefix").unwrap().to_string(),

View File

@ -8,8 +8,8 @@ edition = "2021"
no-assets = []
hot-reloading = ["common-assets/hot-reloading"]
simd = ["vek/platform_intrinsics"]
bin_csv = ["ron", "csv", "structopt"]
bin_graphviz = ["petgraph", "structopt"]
bin_csv = ["ron", "csv", "clap"]
bin_graphviz = ["petgraph", "clap"]
bin_cmd_doc_gen = []
bin_asset_migrate = ["ron"]
rrt_pathfinding = ["kiddo"]
@ -40,7 +40,6 @@ strum = { version = "0.24", features = ["derive"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.4.0"
clap = "2.33"
crossbeam-utils = "0.8.1"
bitflags = "1.2"
crossbeam-channel = "0.5"
@ -67,11 +66,11 @@ serde_repr = "0.1.6"
ron = { version = "0.7", default-features = false, optional = true }
# csv export
csv = { version = "1.1.3", optional = true }
structopt = { version = "0.3.13", optional = true }
# graphviz exporters
petgraph = { version = "0.6", optional = true }
# K-d trees used for RRT pathfinding
kiddo = { version = "0.2", optional = true }
clap = { version = "4.2", optional = true }
# Data structures
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
@ -91,7 +90,6 @@ rand_chacha = "0.3"
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["fmt", "time", "ansi", "smallvec", "env-filter"] }
petgraph = "0.6.0"
[[bench]]
name = "chonk_benchmark"
harness = false

View File

@ -1,11 +1,11 @@
#![deny(clippy::clone_on_ref_ptr)]
use clap::Parser;
use std::{
error::Error,
io::Write,
ops::{Div, Mul},
};
use structopt::StructOpt;
use veloren_common::{
assets::{self, AssetExt},
@ -24,7 +24,7 @@ use veloren_common::{
use vek::Vec3;
#[derive(StructOpt)]
#[derive(Parser)]
struct Cli {
/// Available arguments: "armor-stats", "weapon-stats", "all-items",
/// "loot-table", "entity-drops"
@ -496,7 +496,7 @@ fn entity_drops(entity_config: &str) -> Result<(), Box<dyn Error>> {
}
fn main() {
let args = Cli::from_args();
let args = Cli::parse();
if args.function.eq_ignore_ascii_case("armor-stats") {
if let Err(e) = armor_stats() {
println!("Error: {}\n", e)

View File

@ -1,11 +1,11 @@
#![deny(clippy::clone_on_ref_ptr)]
#![allow(clippy::expect_fun_call)] //TODO: evaluate to remove this and use `unwrap_or_else(panic!(...))` instead
use clap::Parser;
use hashbrown::HashMap;
use ron::ser::{to_string_pretty, PrettyConfig};
use serde::Serialize;
use std::{error::Error, fs::File, io::Write};
use structopt::StructOpt;
use veloren_common::{
assets::ASSETS_PATH,
@ -19,7 +19,7 @@ use veloren_common::{
},
};
#[derive(StructOpt)]
#[derive(Parser)]
struct Cli {
/// Available arguments: "armor-stats", "weapon-stats"
function: String,
@ -463,7 +463,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
}
fn main() {
let args = Cli::from_args();
let args = Cli::parse();
if args.function.eq_ignore_ascii_case("armor-stats") {
if get_input(
"

View File

@ -1,10 +1,10 @@
use clap::Parser;
use hashbrown::HashMap;
use petgraph::{
dot::{Config, Dot},
Graph,
};
use std::{fs::File, io::Write};
use structopt::StructOpt;
use veloren_common::comp::{
item::tool::ToolKind,
skillset::{
@ -12,14 +12,14 @@ use veloren_common::comp::{
},
};
#[derive(StructOpt)]
#[derive(Parser)]
struct Cli {
/// Available arguments: "sword"
skill_group: String,
}
fn main() {
let args = Cli::from_args();
let args = Cli::parse();
let skill_group = match args.skill_group.as_str() {
"sword" => SkillGroupKind::Weapon(ToolKind::Sword),
_ => {

View File

@ -1,13 +1,15 @@
use clap::arg_enum;
use serde::{Deserialize, Serialize};
use specs::{Component, DerefFlaggedStorage, VecStorage};
use strum::EnumVariantNames;
arg_enum! {
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub enum AdminRole {
Moderator = 0,
Admin = 1,
}
// EnumVariantNames is used by bins for clap only, but using strum here gets rid
// of the clap dependency
#[derive(
Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize, EnumVariantNames,
)]
pub enum AdminRole {
Moderator = 0,
Admin = 1,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -46,6 +46,7 @@ shell-words = "1.0.0"
tracing = { version = "0.1", default-features = false }
ron = {version = "0.8", default-features = false}
serde = {version = "1.0", features = [ "rc", "derive" ]}
strum = { version = "0.24" }
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -2,6 +2,7 @@ use clap::Parser;
use common::comp;
use server::persistence::SqlLogMode;
use std::sync::mpsc::Sender;
use strum::VariantNames;
use tracing::error;
#[derive(Clone, Debug, Parser)]
@ -11,7 +12,7 @@ pub enum Admin {
/// Name of the admin to whom to assign a role
username: String,
/// role to assign to the admin
#[arg(ignore_case = true, value_parser = SqlLogMode::variants())]
#[arg(ignore_case = true, value_parser = clap::builder::PossibleValuesParser::new(comp::AdminRole::VARIANTS))]
role: comp::AdminRole,
},
Remove {