From 41480e708524462451b8bd5778235eb759ec0261 Mon Sep 17 00:00:00 2001 From: Brice Delli Paoli Date: Thu, 10 May 2018 12:29:35 -0400 Subject: [PATCH] rustfmt changes --- connect/src/spirc.rs | 3 ++- examples/play.rs | 2 +- playback/src/audio_backend/jackaudio.rs | 6 ++++-- src/main.rs | 14 ++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 4cc86d3a..3c4c773a 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -200,7 +200,8 @@ fn calc_logarithmic_volume(volume: u16) -> u16 { fn write_volume(volume: u16, filepath: Option) { let volume = volume as i32 * 100 / 0xFFFF; let mut file = File::create(filepath.unwrap()).expect("Could not create persistent volume"); - file.write_all(volume.to_string().as_bytes()).expect("Could not write persistent volume"); + file.write_all(volume.to_string().as_bytes()) + .expect("Could not write persistent volume"); } fn volume_to_mixer(volume: u16, linear_volume: bool, persist_volume: Option) -> u16 { diff --git a/examples/play.rs b/examples/play.rs index c7785e15..ac261978 100644 --- a/examples/play.rs +++ b/examples/play.rs @@ -36,7 +36,7 @@ fn main() { let session = core.run(Session::connect(session_config, credentials, None, handle)) .unwrap(); - let (player, _)= Player::new(player_config, session.clone(), None, move || (backend)(None)); + let (player, _) = Player::new(player_config, session.clone(), None, move || (backend)(None)); println!("Playing..."); core.run(player.load(track, true, 0)).unwrap(); diff --git a/playback/src/audio_backend/jackaudio.rs b/playback/src/audio_backend/jackaudio.rs index 98a68ec9..d0387280 100644 --- a/playback/src/audio_backend/jackaudio.rs +++ b/playback/src/audio_backend/jackaudio.rs @@ -1,6 +1,8 @@ use super::{Open, Sink}; -use jack::prelude::{client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port, - ProcessHandler, ProcessScope}; +use jack::prelude::{ + client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port, ProcessHandler, + ProcessScope, +}; use std::io; use std::sync::mpsc::{sync_channel, Receiver, SyncSender}; diff --git a/src/main.rs b/src/main.rs index abf96267..b9755d5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,8 +92,11 @@ fn list_backends() { fn read_volume(filepath: String) -> i32 { let mut data = String::new(); let mut file = File::open(filepath).expect("Could not open persistent volume"); - file.read_to_string(&mut data).expect("Could not read persistent volume"); - let volume = data.trim().parse::().expect("Persistent volume must be an integer"); + file.read_to_string(&mut data) + .expect("Could not read persistent volume"); + let volume = data.trim() + .parse::() + .expect("Persistent volume must be an integer"); if volume < 0 || volume > 100 { panic!("Initial volume must be in the range 0-100"); } @@ -163,12 +166,7 @@ fn setup(args: &[String]) -> Setup { "Initial volume in %, once connected (must be from 0 to 100)", "VOLUME", ) - .optopt( - "", - "persist-volume", - "Persist software volume to file", - "FILE" - ) + .optopt("", "persist-volume", "Persist software volume to file", "FILE") .optopt( "", "zeroconf-port",