mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
--all-targets does not run targets that needs some features which are not provided. --all-features is NOT possible as we have some features which are conflicting.
The only possibility is to manually add the features we need to check in CI to the clippy query
This commit is contained in:
parent
f2eedf81f4
commit
846df3a18a
@ -6,7 +6,7 @@ code-quality:
|
|||||||
script:
|
script:
|
||||||
- ln -s /dockercache/target target
|
- ln -s /dockercache/target target
|
||||||
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||||
- cargo clippy --all-targets --locked -- -D warnings
|
- cargo clippy --all-targets --locked --features="bin_csv,bin_bot" -- -D warnings
|
||||||
- cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
|
|
||||||
security:
|
security:
|
||||||
|
@ -45,15 +45,14 @@ fn main() {
|
|||||||
|
|
||||||
let runtime = Arc::new(Runtime::new().unwrap());
|
let runtime = Arc::new(Runtime::new().unwrap());
|
||||||
let runtime2 = Arc::clone(&runtime);
|
let runtime2 = Arc::clone(&runtime);
|
||||||
|
let addr = ConnectionArgs::Tcp {
|
||||||
|
prefer_ipv6: false,
|
||||||
|
hostname: server_addr,
|
||||||
|
};
|
||||||
|
|
||||||
// Create a client.
|
// Create a client.
|
||||||
let mut client = runtime
|
let mut client = runtime
|
||||||
.block_on(async {
|
.block_on(Client::new(addr, runtime2, &mut None))
|
||||||
let addr = ConnectionArgs::resolve(&server_addr, false)
|
|
||||||
.await
|
|
||||||
.expect("dns resolve failed");
|
|
||||||
Client::new(addr, None, runtime2, &mut None).await
|
|
||||||
})
|
|
||||||
.expect("Failed to create client instance");
|
.expect("Failed to create client instance");
|
||||||
|
|
||||||
println!("Server info: {:?}", client.server_info());
|
println!("Server info: {:?}", client.server_info());
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![feature(str_split_once)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
|
|
||||||
use authc::AuthClient;
|
use authc::AuthClient;
|
||||||
@ -54,15 +52,13 @@ pub struct BotClient {
|
|||||||
|
|
||||||
pub fn make_client(runtime: &Arc<Runtime>, server: &str) -> Client {
|
pub fn make_client(runtime: &Arc<Runtime>, server: &str) -> Client {
|
||||||
let runtime2 = Arc::clone(&runtime);
|
let runtime2 = Arc::clone(&runtime);
|
||||||
let view_distance: Option<u32> = None;
|
let addr = ConnectionArgs::Tcp {
|
||||||
runtime.block_on(async {
|
prefer_ipv6: false,
|
||||||
let connection_args = ConnectionArgs::resolve(server, false)
|
hostname: server.to_owned(),
|
||||||
.await
|
};
|
||||||
.expect("DNS resolution failed");
|
runtime
|
||||||
Client::new(connection_args, view_distance, runtime2, &mut None)
|
.block_on(Client::new(addr, runtime2, &mut None))
|
||||||
.await
|
.expect("Failed to connect to server")
|
||||||
.expect("Failed to connect to server")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BotClient {
|
impl BotClient {
|
||||||
@ -84,7 +80,7 @@ impl BotClient {
|
|||||||
for (username, client) in self.bot_clients.iter_mut() {
|
for (username, client) in self.bot_clients.iter_mut() {
|
||||||
//trace!("cl {:?}: {:?}", username, client.character_list());
|
//trace!("cl {:?}: {:?}", username, client.character_list());
|
||||||
trace!(?username, "tick");
|
trace!(?username, "tick");
|
||||||
let msgs: Result<Vec<veloren_client::Event>, veloren_client::Error> =
|
let _msgs: Result<Vec<veloren_client::Event>, veloren_client::Error> =
|
||||||
client.tick(comp::ControllerInputs::default(), self.clock.dt(), |_| {});
|
client.tick(comp::ControllerInputs::default(), self.clock.dt(), |_| {});
|
||||||
/*trace!(
|
/*trace!(
|
||||||
"msgs {:?}: {:?} {:?}",
|
"msgs {:?}: {:?} {:?}",
|
||||||
@ -131,7 +127,7 @@ impl BotClient {
|
|||||||
.settings
|
.settings
|
||||||
.bot_logins
|
.bot_logins
|
||||||
.iter()
|
.iter()
|
||||||
.any(|x| &*x.username == &*username)
|
.any(|x| *x.username == *username)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -216,9 +212,6 @@ impl BotClient {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
for cred in creds.iter() {
|
for cred in creds.iter() {
|
||||||
let runtime = Arc::clone(&self.runtime);
|
|
||||||
|
|
||||||
let server = self.settings.server.clone();
|
|
||||||
let client = match self.bot_clients.get_mut(&cred.username) {
|
let client = match self.bot_clients.get_mut(&cred.username) {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
None => {
|
None => {
|
||||||
|
@ -27,16 +27,11 @@ impl Tui {
|
|||||||
let handle = thread::spawn(move || {
|
let handle = thread::spawn(move || {
|
||||||
thread::sleep(Duration::from_millis(20));
|
thread::sleep(Duration::from_millis(20));
|
||||||
let mut readline = rustyline::Editor::<()>::new();
|
let mut readline = rustyline::Editor::<()>::new();
|
||||||
loop {
|
while let Ok(cmd) = readline.readline("\n\nbotclient> ") {
|
||||||
match readline.readline("\n\nbotclient> ") {
|
let keep_going = Self::process_command(&cmd, &mut commands_s);
|
||||||
Ok(cmd) => {
|
readline.add_history_entry(cmd);
|
||||||
let keep_going = Self::process_command(&cmd, &mut commands_s);
|
if !keep_going {
|
||||||
readline.add_history_entry(cmd);
|
break;
|
||||||
if !keep_going {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(_) => break,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -69,7 +64,7 @@ impl Tui {
|
|||||||
.about("Join the world with some random character")
|
.about("Join the world with some random character")
|
||||||
.args(&[Arg::with_name("prefix").required(true)]),
|
.args(&[Arg::with_name("prefix").required(true)]),
|
||||||
)
|
)
|
||||||
.get_matches_from_safe(cmd.split(" "));
|
.get_matches_from_safe(cmd.split(' '));
|
||||||
use clap::ErrorKind::*;
|
use clap::ErrorKind::*;
|
||||||
match matches {
|
match matches {
|
||||||
Ok(matches) => {
|
Ok(matches) => {
|
||||||
|
@ -121,7 +121,6 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
let poise_strength = tool.base_poise_strength(&msm, &[]).to_string();
|
let poise_strength = tool.base_poise_strength(&msm, &[]).to_string();
|
||||||
let speed = tool.base_speed(&msm, &[]).to_string();
|
let speed = tool.base_speed(&msm, &[]).to_string();
|
||||||
let crit_chance = tool.base_crit_chance(&msm, &[]).to_string();
|
let crit_chance = tool.base_crit_chance(&msm, &[]).to_string();
|
||||||
let crit_mult = tool.base_crit_mult(&msm, &[]).to_string();
|
|
||||||
let equip_time = tool.equip_time(&msm, &[]).as_secs_f32().to_string();
|
let equip_time = tool.equip_time(&msm, &[]).as_secs_f32().to_string();
|
||||||
let kind = get_tool_kind(&tool.kind);
|
let kind = get_tool_kind(&tool.kind);
|
||||||
let hands = get_tool_hands(&tool);
|
let hands = get_tool_hands(&tool);
|
||||||
@ -136,7 +135,6 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
&poise_strength,
|
&poise_strength,
|
||||||
&speed,
|
&speed,
|
||||||
&crit_chance,
|
&crit_chance,
|
||||||
&crit_mult,
|
|
||||||
&equip_time,
|
&equip_time,
|
||||||
item.description(),
|
item.description(),
|
||||||
])?;
|
])?;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![deny(clippy::clone_on_ref_ptr)]
|
#![deny(clippy::clone_on_ref_ptr)]
|
||||||
|
#![allow(clippy::expect_fun_call)]
|
||||||
|
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use ron::ser::{to_string_pretty, PrettyConfig};
|
use ron::ser::{to_string_pretty, PrettyConfig};
|
||||||
@ -68,11 +69,8 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
{
|
{
|
||||||
match item.kind() {
|
match item.kind() {
|
||||||
comp::item::ItemKind::Armor(armor) => {
|
comp::item::ItemKind::Armor(armor) => {
|
||||||
match armor.kind {
|
if let ArmorKind::Bag(_) = armor.kind {
|
||||||
ArmorKind::Bag(_) => {
|
continue;
|
||||||
continue;
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(ref record) = record {
|
if let Ok(ref record) = record {
|
||||||
@ -217,7 +215,7 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
.with_enumerate_arrays(true);
|
.with_enumerate_arrays(true);
|
||||||
|
|
||||||
let mut path = ASSETS_PATH.clone();
|
let mut path = ASSETS_PATH.clone();
|
||||||
for part in item.item_definition_id().split(".") {
|
for part in item.item_definition_id().split('.') {
|
||||||
path.push(part);
|
path.push(part);
|
||||||
}
|
}
|
||||||
path.set_extension("ron");
|
path.set_extension("ron");
|
||||||
@ -329,15 +327,6 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
.parse()
|
.parse()
|
||||||
.expect(&format!("Not a f32? {:?}", item.item_definition_id()));
|
.expect(&format!("Not a f32? {:?}", item.item_definition_id()));
|
||||||
|
|
||||||
let crit_mult: f32 = record
|
|
||||||
.get(headers["Crit Mult"])
|
|
||||||
.expect(&format!(
|
|
||||||
"Error unwrapping crit_mult for {:?}",
|
|
||||||
item.item_definition_id()
|
|
||||||
))
|
|
||||||
.parse()
|
|
||||||
.expect(&format!("Not a f32? {:?}", item.item_definition_id()));
|
|
||||||
|
|
||||||
let tool = comp::item::tool::Tool::new(
|
let tool = comp::item::tool::Tool::new(
|
||||||
kind,
|
kind,
|
||||||
hands,
|
hands,
|
||||||
@ -346,7 +335,6 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
poise_strength,
|
poise_strength,
|
||||||
speed,
|
speed,
|
||||||
crit_chance,
|
crit_chance,
|
||||||
crit_mult,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let quality = if let Some(quality_raw) = record.get(headers["Quality"])
|
let quality = if let Some(quality_raw) = record.get(headers["Quality"])
|
||||||
@ -396,7 +384,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
|
|||||||
.with_enumerate_arrays(true);
|
.with_enumerate_arrays(true);
|
||||||
|
|
||||||
let mut path = ASSETS_PATH.clone();
|
let mut path = ASSETS_PATH.clone();
|
||||||
for part in item.item_definition_id().split(".") {
|
for part in item.item_definition_id().split('.') {
|
||||||
path.push(part);
|
path.push(part);
|
||||||
}
|
}
|
||||||
path.set_extension("ron");
|
path.set_extension("ron");
|
||||||
@ -432,41 +420,39 @@ fn loot_table(loot_table: &str) -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
let mut items = Vec::<(f32, LootSpec)>::new();
|
let mut items = Vec::<(f32, LootSpec)>::new();
|
||||||
|
|
||||||
for record in rdr.records() {
|
for ref record in rdr.records().flatten() {
|
||||||
if let Ok(ref record) = record {
|
let item = match record.get(headers["Kind"]).expect("No loot specifier") {
|
||||||
let item = match record.get(headers["Kind"]).expect("No loot specifier") {
|
"Item" => {
|
||||||
"Item" => {
|
if let (Some(Ok(lower)), Some(Ok(upper))) = (
|
||||||
if let (Some(Ok(lower)), Some(Ok(upper))) = (
|
record.get(headers["Lower Amount"]).map(|a| a.parse()),
|
||||||
record.get(headers["Lower Amount"]).map(|a| a.parse()),
|
record.get(headers["Upper Amount"]).map(|a| a.parse()),
|
||||||
record.get(headers["Upper Amount"]).map(|a| a.parse()),
|
) {
|
||||||
) {
|
LootSpec::ItemQuantity(
|
||||||
LootSpec::ItemQuantity(
|
record.get(headers["Item"]).expect("No item").to_string(),
|
||||||
record.get(headers["Item"]).expect("No item").to_string(),
|
lower,
|
||||||
lower,
|
upper,
|
||||||
upper,
|
)
|
||||||
)
|
} else {
|
||||||
} else {
|
LootSpec::Item(record.get(headers["Item"]).expect("No item").to_string())
|
||||||
LootSpec::Item(record.get(headers["Item"]).expect("No item").to_string())
|
}
|
||||||
}
|
},
|
||||||
},
|
"LootTable" => LootSpec::LootTable(
|
||||||
"LootTable" => LootSpec::LootTable(
|
record
|
||||||
record
|
.get(headers["Item"])
|
||||||
.get(headers["Item"])
|
.expect("No loot table")
|
||||||
.expect("No loot table")
|
.to_string(),
|
||||||
.to_string(),
|
),
|
||||||
),
|
a => panic!(
|
||||||
a => panic!(
|
"Loot specifier kind must be either \"Item\" or \"LootTable\"\n{}",
|
||||||
"Loot specifier kind must be either \"Item\" or \"LootTable\"\n{}",
|
a
|
||||||
a
|
),
|
||||||
),
|
};
|
||||||
};
|
let chance: f32 = record
|
||||||
let chance: f32 = record
|
.get(headers["Relative Chance"])
|
||||||
.get(headers["Relative Chance"])
|
.expect("No chance for item in entry")
|
||||||
.expect("No chance for item in entry")
|
.parse()
|
||||||
.parse()
|
.expect("Not an f32 for chance in entry");
|
||||||
.expect("Not an f32 for chance in entry");
|
items.push((chance, item));
|
||||||
items.push((chance, item));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let pretty_config = PrettyConfig::new()
|
let pretty_config = PrettyConfig::new()
|
||||||
@ -476,7 +462,7 @@ fn loot_table(loot_table: &str) -> Result<(), Box<dyn Error>> {
|
|||||||
let mut path = ASSETS_PATH.clone();
|
let mut path = ASSETS_PATH.clone();
|
||||||
path.push("common");
|
path.push("common");
|
||||||
path.push("loot_tables");
|
path.push("loot_tables");
|
||||||
for part in loot_table.split(".") {
|
for part in loot_table.split('.') {
|
||||||
path.push(part);
|
path.push(part);
|
||||||
}
|
}
|
||||||
path.set_extension("ron");
|
path.set_extension("ron");
|
||||||
@ -514,7 +500,7 @@ Would you like to continue? (y/n)
|
|||||||
> ",
|
> ",
|
||||||
)
|
)
|
||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
== "y".to_string()
|
== *"y"
|
||||||
{
|
{
|
||||||
if let Err(e) = armor_stats() {
|
if let Err(e) = armor_stats() {
|
||||||
println!("Error: {}\n", e)
|
println!("Error: {}\n", e)
|
||||||
@ -544,7 +530,7 @@ Would you like to continue? (y/n)
|
|||||||
> ",
|
> ",
|
||||||
)
|
)
|
||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
== "y".to_string()
|
== *"y"
|
||||||
{
|
{
|
||||||
if let Err(e) = weapon_stats() {
|
if let Err(e) = weapon_stats() {
|
||||||
println!("Error: {}\n", e)
|
println!("Error: {}\n", e)
|
||||||
@ -578,7 +564,7 @@ Would you like to continue? (y/n)
|
|||||||
> ",
|
> ",
|
||||||
)
|
)
|
||||||
.to_lowercase()
|
.to_lowercase()
|
||||||
== "y".to_string()
|
== *"y"
|
||||||
{
|
{
|
||||||
if let Err(e) = loot_table(&loot_table_name) {
|
if let Err(e) = loot_table(&loot_table_name) {
|
||||||
println!("Error: {}\n", e)
|
println!("Error: {}\n", e)
|
||||||
|
Loading…
Reference in New Issue
Block a user