mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix clippy warnings
This commit is contained in:
parent
522880a0ab
commit
fb2cf1a292
@ -44,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Overhauled representation of blocks to permit fluid and sprite coexistence
|
||||
- Overhauled sword
|
||||
- Reworked healing sceptre
|
||||
- Split out the sections of the server settings that can be edtited and saved by the server.
|
||||
- Split out the sections of the server settings that can be edited and saved by the server.
|
||||
- Revamped structure of where settings, logs, and game saves are stored so that almost everything is in one place.
|
||||
|
||||
### Removed
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
projectile, Damage, DamageSource, Energy, EnergySource, HealthChange, HealthSource, Group,
|
||||
projectile, Damage, DamageSource, Energy, EnergySource, Group, HealthChange, HealthSource,
|
||||
Loadout, Ori, PhysicsState, Pos, Projectile, Vel,
|
||||
},
|
||||
event::{EventBus, LocalEvent, ServerEvent},
|
||||
|
@ -1,9 +1,9 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
const VELOREN_USERDATA_ENV: &'static str = "VELOREN_USERDATA";
|
||||
const VELOREN_USERDATA_ENV: &str = "VELOREN_USERDATA";
|
||||
|
||||
// TODO: consider expanding this to a general install strategy variable that is also used for
|
||||
// finding assets
|
||||
// TODO: consider expanding this to a general install strategy variable that is
|
||||
// also used for finding assets
|
||||
/// # `VELOREN_USERDATA_STRATEGY` environment variable
|
||||
/// Read during compilation
|
||||
/// Useful to set when compiling for distribution
|
||||
@ -15,8 +15,8 @@ const VELOREN_USERDATA_ENV: &'static str = "VELOREN_USERDATA";
|
||||
/// The first specified in this list is used
|
||||
/// 1. The VELOREN_USERDATA environment variable
|
||||
/// 2. The VELOREN_USERDATA_STRATEGY environment variable
|
||||
/// 3. The CARGO_MANIFEST_DIR/userdata or CARGO_MANIFEST_DIR/../userdata depending on if a
|
||||
/// workspace if being used
|
||||
/// 3. The CARGO_MANIFEST_DIR/userdata or CARGO_MANIFEST_DIR/../userdata
|
||||
/// depending on if a workspace if being used
|
||||
pub fn userdata_dir(workspace: bool, strategy: Option<&str>, manifest_dir: &str) -> PathBuf {
|
||||
// 1. The VELOREN_USERDATA environment variable
|
||||
std::env::var_os(VELOREN_USERDATA_ENV)
|
||||
@ -39,7 +39,6 @@ pub fn userdata_dir(workspace: bool, strategy: Option<&str>, manifest_dir: &str)
|
||||
},
|
||||
Some(_) => None, // TODO: panic? catch during compilation?
|
||||
_ => None,
|
||||
|
||||
})
|
||||
// 3. The CARGO_MANIFEST_DIR/userdata or CARGO_MANIFEST_DIR/../userdata depending on if a
|
||||
// workspace if being used
|
||||
@ -58,7 +57,8 @@ macro_rules! userdata_dir_workspace {
|
||||
() => {
|
||||
$crate::util::userdata_dir::userdata_dir(
|
||||
true,
|
||||
option_env!("VELOREN_USERDATA_STRATEGY"), env!("CARGO_MANIFEST_DIR")
|
||||
option_env!("VELOREN_USERDATA_STRATEGY"),
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
)
|
||||
};
|
||||
}
|
||||
@ -68,9 +68,8 @@ macro_rules! userdata_dir_no_workspace {
|
||||
() => {
|
||||
$crate::util::userdata_dir::userdata_dir(
|
||||
false,
|
||||
option_env!("VELOREN_USERDATA_STRATEGY"), env!("CARGO_MANIFEST_DIR")
|
||||
option_env!("VELOREN_USERDATA_STRATEGY"),
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ impl Tui {
|
||||
pub fn run(basic: bool) -> Self {
|
||||
let (mut msg_s, msg_r) = mpsc::channel();
|
||||
let running = Arc::new(AtomicBool::new(true));
|
||||
let running2 = running.clone();
|
||||
let running2 = Arc::clone(&running);
|
||||
|
||||
let background = if basic {
|
||||
std::thread::spawn(move || {
|
||||
|
@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
/// Used so that different server frontends can share the same server saves,
|
||||
/// etc.
|
||||
pub const DEFAULT_DATA_DIR_NAME: &'static str = "server";
|
||||
pub const DEFAULT_DATA_DIR_NAME: &str = "server";
|
||||
|
||||
/// Indicates where maps, saves, and server_config folders are to be stored
|
||||
pub struct DataDir {
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
pub mod alias_validator;
|
||||
mod character_creator;
|
||||
mod data_dir;
|
||||
pub mod chunk_generator;
|
||||
pub mod client;
|
||||
pub mod cmd;
|
||||
mod data_dir;
|
||||
pub mod error;
|
||||
pub mod events;
|
||||
pub mod input;
|
||||
@ -22,7 +22,13 @@ pub mod sys;
|
||||
#[cfg(not(feature = "worldgen"))] mod test_world;
|
||||
|
||||
// Reexports
|
||||
pub use crate::{error::Error, events::Event, input::Input, settings::ServerSettings, data_dir::{DataDir, DEFAULT_DATA_DIR_NAME}};
|
||||
pub use crate::{
|
||||
data_dir::{DataDir, DEFAULT_DATA_DIR_NAME},
|
||||
error::Error,
|
||||
events::Event,
|
||||
input::Input,
|
||||
settings::ServerSettings,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
alias_validator::AliasValidator,
|
||||
@ -125,7 +131,9 @@ impl Server {
|
||||
state.ecs_mut().insert(settings.clone());
|
||||
state.ecs_mut().insert(Whitelist::load(&data_dir.path));
|
||||
state.ecs_mut().insert(Banlist::load(&data_dir.path));
|
||||
state.ecs_mut().insert(ServerDescription::load(&data_dir.path));
|
||||
state
|
||||
.ecs_mut()
|
||||
.insert(ServerDescription::load(&data_dir.path));
|
||||
state.ecs_mut().insert(data_dir);
|
||||
state.ecs_mut().insert(EventBus::<ServerEvent>::default());
|
||||
state
|
||||
|
@ -18,11 +18,11 @@ use world::sim::FileOpts;
|
||||
|
||||
const DEFAULT_WORLD_SEED: u32 = 59686;
|
||||
//const CONFIG_DIR_ENV: &'static str = "VELOREN_SERVER_CONFIG";
|
||||
const /*DEFAULT_*/CONFIG_DIR: &'static str = "server_config";
|
||||
const SETTINGS_FILENAME: &'static str = "settings.ron";
|
||||
const WHITELIST_FILENAME: &'static str = "whitelist.ron";
|
||||
const BANLIST_FILENAME: &'static str = "banlist.ron";
|
||||
const SERVER_DESCRIPTION_FILENAME: &'static str = "description.ron";
|
||||
const /*DEFAULT_*/CONFIG_DIR: &str = "server_config";
|
||||
const SETTINGS_FILENAME: &str = "settings.ron";
|
||||
const WHITELIST_FILENAME: &str = "whitelist.ron";
|
||||
const BANLIST_FILENAME: &str = "banlist.ron";
|
||||
const SERVER_DESCRIPTION_FILENAME: &str = "description.ron";
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
|
@ -209,7 +209,8 @@ impl Sys {
|
||||
// Give the player a welcome message
|
||||
if !server_description.is_empty() {
|
||||
client.notify(
|
||||
ChatType::CommandInfo.server_msg(String::from(&**server_description)),
|
||||
ChatType::CommandInfo
|
||||
.server_msg(String::from(&**server_description)),
|
||||
);
|
||||
}
|
||||
|
||||
@ -453,7 +454,7 @@ impl<'a> System<'a> for Sys {
|
||||
(
|
||||
ReadExpect<'a, Whitelist>,
|
||||
ReadExpect<'a, Banlist>,
|
||||
ReadExpect<'a, ServerDescription>
|
||||
ReadExpect<'a, ServerDescription>,
|
||||
),
|
||||
);
|
||||
|
||||
@ -488,11 +489,7 @@ impl<'a> System<'a> for Sys {
|
||||
mut controllers,
|
||||
settings,
|
||||
alias_validator,
|
||||
(
|
||||
whitelist,
|
||||
banlist,
|
||||
server_description,
|
||||
),
|
||||
(whitelist, banlist, server_description),
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "run", "message::Sys::run");
|
||||
|
Loading…
Reference in New Issue
Block a user