mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Formatted code.
This commit is contained in:
parent
2215f9abd7
commit
57bfb302dd
@ -470,7 +470,11 @@ fn handle_players(server: &mut Server, entity: EcsEntity, _args: String, _action
|
||||
let header_message: String = format!("{} online players: \n", count);
|
||||
if count > 0 {
|
||||
let mut player_iter = players.join();
|
||||
let first = player_iter.next().expect("Player iterator returned none.").alias.to_owned();
|
||||
let first = player_iter
|
||||
.next()
|
||||
.expect("Player iterator returned none.")
|
||||
.alias
|
||||
.to_owned();
|
||||
let player_list = player_iter.fold(first, |mut s, p| {
|
||||
s += ",\n";
|
||||
s += &p.alias;
|
||||
|
@ -126,7 +126,8 @@ impl Server {
|
||||
git_hash: common::util::GIT_HASH.to_string(),
|
||||
git_date: common::util::GIT_DATE.to_string(),
|
||||
},
|
||||
metrics: ServerMetrics::new(settings.metrics_address).expect("Failed to initialize server metrics submodule."),
|
||||
metrics: ServerMetrics::new(settings.metrics_address)
|
||||
.expect("Failed to initialize server metrics submodule."),
|
||||
accounts: AuthProvider::new(),
|
||||
server_settings: settings.clone(),
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
use log::info;
|
||||
use prometheus::{Encoder, Gauge, IntGauge, IntGaugeVec, Opts, Registry, TextEncoder};
|
||||
use rouille::{router, Server};
|
||||
use std::error::Error;
|
||||
use std::{
|
||||
convert::TryInto,
|
||||
net::SocketAddr,
|
||||
@ -11,7 +12,6 @@ use std::{
|
||||
thread,
|
||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use std::error::Error;
|
||||
|
||||
pub struct ServerMetrics {
|
||||
pub chonks_count: IntGauge,
|
||||
|
@ -43,7 +43,10 @@ impl Default for ServerSettings {
|
||||
"Nancok",
|
||||
"Qutrin",
|
||||
"Mckol",
|
||||
].iter().map(|n| n.to_string()).collect(),
|
||||
]
|
||||
.iter()
|
||||
.map(|n| n.to_string())
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,8 +78,11 @@ impl ServerSettings {
|
||||
let path = ServerSettings::get_settings_path();
|
||||
let mut config_file = fs::File::create(path)?;
|
||||
|
||||
let s: &str = &ron::ser::to_string_pretty(self, ron::ser::PrettyConfig::default()).expect("Failed serialize settings.");
|
||||
config_file.write_all(s.as_bytes()).expect("Failed to write to config file.");
|
||||
let s: &str = &ron::ser::to_string_pretty(self, ron::ser::PrettyConfig::default())
|
||||
.expect("Failed serialize settings.");
|
||||
config_file
|
||||
.write_all(s.as_bytes())
|
||||
.expect("Failed to write to config file.");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user