aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-11-02 23:01:08 +0100
committerEskil Queseth <eskilq@kth.se>2020-11-02 23:01:08 +0100
commit36b5d69929d15212f5845f42d0239ba50e46a69c (patch)
tree6d7500c995081b4c51c5bc15aebc839a861e0f04
parent9d60f06ae05c5de08a026c7f9067c1a339bc24be (diff)
downloadmum-36b5d69929d15212f5845f42d0239ba50e46a69c.tar.gz
cargo fmt
-rw-r--r--mumctl/src/main.rs32
-rw-r--r--mumd/src/audio/output.rs2
-rw-r--r--mumlib/src/config.rs16
-rw-r--r--mumlib/src/error.rs4
4 files changed, 28 insertions, 26 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs
index 2ceb99c..005e703 100644
--- a/mumctl/src/main.rs
+++ b/mumctl/src/main.rs
@@ -105,10 +105,10 @@ fn main() {
.subcommand(
SubCommand::with_name("set")
.arg(Arg::with_name("user").required(true))
- .arg(Arg::with_name("volume").required(true))
+ .arg(Arg::with_name("volume").required(true)),
)
.arg(Arg::with_name("user").required(true))
- .setting(AppSettings::SubcommandsNegateReqs)
+ .setting(AppSettings::SubcommandsNegateReqs),
);
let matches = app.clone().get_matches();
@@ -229,13 +229,15 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
Some(Ok(v)) => Some(v),
};
if let Some(port) = port {
- let (host, port, username) = match config.servers.iter()
- .find(|e| e.name == host)
- {
+ let (host, port, username) = match config.servers.iter().find(|e| e.name == host) {
Some(server_config) => {
let host = server_config.host.as_str();
let port = server_config.port.unwrap_or(port);
- let username = server_config.username.as_ref().map(|e| e.as_str()).or(username);
+ let username = server_config
+ .username
+ .as_ref()
+ .map(|e| e.as_str())
+ .or(username);
if username.is_none() {
println!("{} no username specified", "error:".red());
return;
@@ -255,7 +257,8 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
port,
username: username.to_string(),
accept_invalid_cert: true, //TODO
- }).map(|e| (e, host));
+ })
+ .map(|e| (e, host));
match response {
Ok((e, host)) => {
if let Some(CommandResponse::ServerConnect { welcome_message }) = e {
@@ -272,10 +275,7 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
}
}
-fn match_server_config(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_config(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
if let Some(server_name) = matches.value_of("server_name") {
let server = config.servers.iter_mut().find(|s| s.name == server_name);
if let Some(server) = server {
@@ -373,10 +373,7 @@ fn match_server_config(
}
}
-fn match_server_rename(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_rename(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
//if let Some(servers) = &mut config.servers {
let prev_name = matches.value_of("prev_name").unwrap();
let next_name = matches.value_of("next_name").unwrap();
@@ -388,10 +385,7 @@ fn match_server_rename(
//}
}
-fn match_server_remove(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_remove(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
let name = matches.value_of("name").unwrap();
//if let Some(servers) = &mut config.servers {
match config.servers.iter().position(|server| server.name == name) {
diff --git a/mumd/src/audio/output.rs b/mumd/src/audio/output.rs
index 78dba02..56da596 100644
--- a/mumd/src/audio/output.rs
+++ b/mumd/src/audio/output.rs
@@ -74,7 +74,7 @@ impl SaturatingAdd for u16 {
pub fn curry_callback<T: Sample + AddAssign + SaturatingAdd>(
buf: Arc<Mutex<HashMap<u32, ClientStream>>>,
output_volume_receiver: watch::Receiver<f32>,
- user_volumes: Arc<Mutex<HashMap<u32, f32>>>
+ user_volumes: Arc<Mutex<HashMap<u32, f32>>>,
) -> impl FnMut(&mut [T], &OutputCallbackInfo) + Send + 'static {
move |data: &mut [T], _info: &OutputCallbackInfo| {
for sample in data.iter_mut() {
diff --git a/mumlib/src/config.rs b/mumlib/src/config.rs
index 210dc7b..2eca104 100644
--- a/mumlib/src/config.rs
+++ b/mumlib/src/config.rs
@@ -137,9 +137,13 @@ impl From<Config> for TOMLConfig {
} else {
None
},
- servers: Some(config.servers.into_iter()
- .map(|s| Value::try_from::<ServerConfig>(s).unwrap())
- .collect()),
+ servers: Some(
+ config
+ .servers
+ .into_iter()
+ .map(|s| Value::try_from::<ServerConfig>(s).unwrap())
+ .collect(),
+ ),
}
}
}
@@ -149,6 +153,8 @@ pub fn read_default_cfg() -> Config {
toml::from_str::<TOMLConfig>(&match fs::read_to_string(get_cfg_path()) {
Ok(f) => f,
Err(_) => return Config::default(),
- }).expect("invalid TOML in config file"), //TODO
- ).expect("invalid config in TOML") //TODO
+ })
+ .expect("invalid TOML in config file"), //TODO
+ )
+ .expect("invalid config in TOML") //TODO
}
diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs
index eaf517c..1e79b9c 100644
--- a/mumlib/src/error.rs
+++ b/mumlib/src/error.rs
@@ -19,7 +19,9 @@ impl Display for Error {
Error::DisconnectedError => write!(f, "Not connected to a server"),
Error::AlreadyConnectedError => write!(f, "Already connected to a server"),
Error::ChannelIdentifierError(id, kind) => write!(f, "{}: {}", kind, id),
- Error::InvalidServerAddrError(addr, port) => write!(f, "Invalid server address: {}: {}", addr, port),
+ Error::InvalidServerAddrError(addr, port) => {
+ write!(f, "Invalid server address: {}: {}", addr, port)
+ }
Error::InvalidUsernameError(username) => write!(f, "Invalid username: {}", username),
}
}