Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
tignear committed Nov 9, 2024
1 parent fb1e18f commit 61b3fa0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
7 changes: 5 additions & 2 deletions src/driver/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use super::{
tasks::{
message::*,
ws::{self as ws_task, AuxNetwork},
}, Cipher, Config, CryptoMode
},
Cipher,
Config,
CryptoMode,
};
use crate::{
constants::*,
Expand Down Expand Up @@ -346,7 +349,7 @@ async fn init_cipher(client: &mut WsStream, mode: CryptoMode) -> Result<Cipher>
return Err(Error::CryptoModeInvalid);
}

return Ok(mode.new_cipher(&desc.secret_key))
return Ok(mode.new_cipher(&desc.secret_key));
},
other => {
debug!(
Expand Down
5 changes: 2 additions & 3 deletions src/driver/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
Expand Down
20 changes: 10 additions & 10 deletions src/driver/tasks/mixer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 => {},
}
}
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/driver/test_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 61b3fa0

Please sign in to comment.