From 61b3fa071a861dc25ba7f819762c47d7b59e8952 Mon Sep 17 00:00:00 2001 From: tignear Date: Sun, 10 Nov 2024 01:09:41 +0900 Subject: [PATCH] format --- src/driver/connection/mod.rs | 7 +++++-- src/driver/crypto.rs | 5 ++--- src/driver/tasks/mixer/mod.rs | 20 ++++++++++---------- src/driver/test_impls.rs | 4 +++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/driver/connection/mod.rs b/src/driver/connection/mod.rs index eb9668876..4a14a6e49 100644 --- a/src/driver/connection/mod.rs +++ b/src/driver/connection/mod.rs @@ -6,7 +6,10 @@ use super::{ tasks::{ message::*, ws::{self as ws_task, AuxNetwork}, - }, Cipher, Config, CryptoMode + }, + Cipher, + Config, + CryptoMode, }; use crate::{ constants::*, @@ -346,7 +349,7 @@ async fn init_cipher(client: &mut WsStream, mode: CryptoMode) -> Result return Err(Error::CryptoModeInvalid); } - return Ok(mode.new_cipher(&desc.secret_key)) + return Ok(mode.new_cipher(&desc.secret_key)); }, other => { debug!( diff --git a/src/driver/crypto.rs b/src/driver/crypto.rs index 17ac5f818..1de3a8b7d 100644 --- a/src/driver/crypto.rs +++ b/src/driver/crypto.rs @@ -278,9 +278,8 @@ impl CryptoMode { CryptoMode::Lite | CryptoMode::Normal | CryptoMode::Suffix => Cipher::XSalsa20( XSalsa20Poly1305::new_from_slice(&key[..XSalsa20Poly1305::KEY_SIZE]).unwrap(), ), - CryptoMode::Aes256Gcm => { - Cipher::Aes256Gcm(Aes256Gcm::new_from_slice(&key[..Aes256Gcm::key_size()]).unwrap()) - }, + CryptoMode::Aes256Gcm => + Cipher::Aes256Gcm(Aes256Gcm::new_from_slice(&key[..Aes256Gcm::key_size()]).unwrap()), CryptoMode::XChaCha20 => Cipher::XChaCha20( XChaCha20Poly1305::new_from_slice(&key[..XChaCha20Poly1305::key_size()]).unwrap(), ), diff --git a/src/driver/tasks/mixer/mod.rs b/src/driver/tasks/mixer/mod.rs index a5d41a0b5..5ff6f8803 100644 --- a/src/driver/tasks/mixer/mod.rs +++ b/src/driver/tasks/mixer/mod.rs @@ -24,7 +24,10 @@ use crate::{ Config, }; use audiopus::{ - coder::Encoder as OpusEncoder, softclip::SoftClip, Application as CodingMode, Bitrate, + coder::Encoder as OpusEncoder, + softclip::SoftClip, + Application as CodingMode, + Bitrate, }; use discortp::{ discord::MutableKeepalivePacket, @@ -499,12 +502,10 @@ impl Mixer { #[inline] pub(crate) fn test_signal_empty_tick(&self) { match &self.config.override_connection { - Some(OutputMode::Raw(tx)) => { - drop(tx.send(crate::driver::test_config::TickMessage::NoEl)) - }, - Some(OutputMode::Rtp(tx)) => { - drop(tx.send(crate::driver::test_config::TickMessage::NoEl)) - }, + Some(OutputMode::Raw(tx)) => + drop(tx.send(crate::driver::test_config::TickMessage::NoEl)), + Some(OutputMode::Rtp(tx)) => + drop(tx.send(crate::driver::test_config::TickMessage::NoEl)), None => {}, } } @@ -838,9 +839,8 @@ impl Mixer { // to recreate? Probably not doable in the general case. match status { MixStatus::Live => track.step_frame(), - MixStatus::Errored(e) => { - track.playing = PlayMode::Errored(PlayError::Decode(e.into())) - }, + MixStatus::Errored(e) => + track.playing = PlayMode::Errored(PlayError::Decode(e.into())), MixStatus::Ended if track.do_loop() => { drop(self.track_handles[i].seek(Duration::default())); if !self.prevent_events { diff --git a/src/driver/test_impls.rs b/src/driver/test_impls.rs index 241c82f5c..1c46674fb 100644 --- a/src/driver/test_impls.rs +++ b/src/driver/test_impls.rs @@ -66,7 +66,9 @@ impl Mixer { #[cfg(feature = "receive")] let fake_conn = MixerConnection { - cipher: Cipher::XSalsa20(XSalsa20Poly1305::new_from_slice(&[0u8; XSalsa20Poly1305::KEY_SIZE]).unwrap()), + cipher: Cipher::XSalsa20( + XSalsa20Poly1305::new_from_slice(&[0u8; XSalsa20Poly1305::KEY_SIZE]).unwrap(), + ), crypto_state: CryptoState::Normal, udp_rx: udp_receiver_tx, udp_tx,