Skip to content

Commit

Permalink
Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Apr 14, 2021
1 parent b963d25 commit cbc859e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions libsignal-service/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ impl ToString for SignalServers {
}
}

impl Into<ServiceConfiguration> for SignalServers {
fn into(self) -> ServiceConfiguration {
impl From<SignalServers> for ServiceConfiguration {
fn from(val: SignalServers) -> Self {
// base configuration from https://github.com/signalapp/Signal-Desktop/blob/development/config/default.json
match self {
match val {
// configuration with the Signal API staging endpoints
// see: https://github.com/signalapp/Signal-Desktop/blob/master/config/default.json
SignalServers::Staging => ServiceConfiguration {
Expand Down
5 changes: 2 additions & 3 deletions libsignal-service/src/groups_v2/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ impl CredentialResponse {
pub fn parse(
self,
) -> Result<HashMap<i64, AuthCredentialResponse>, ServiceError> {
Ok(self
.credentials
self.credentials
.into_iter()
.map(|c| {
let bytes = base64::decode(c.credential)?;
let data = bincode::deserialize(&bytes)?;
Ok((c.redemption_time, data))
})
.collect::<Result<_, ServiceError>>()?)
.collect::<Result<_, ServiceError>>()
}
}

Expand Down
2 changes: 1 addition & 1 deletion libsignal-service/src/profile_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn pad_plaintext(
let len = brackets
.iter()
.find(|x| **x >= bytes.len())
.ok_or_else(|| ProfileCipherError::InputTooLong)?;
.ok_or(ProfileCipherError::InputTooLong)?;
let len: usize = *len;

bytes.resize(len, 0);
Expand Down
8 changes: 4 additions & 4 deletions libsignal-service/src/sealed_session_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ impl UnidentifiedSenderMessage {

fn into_bytes(self) -> Result<Vec<u8>, SealedSessionError> {
use prost::Message;
let mut buf = vec![];
buf.push(Self::CIPHERTEXT_VERSION << 4 | Self::CIPHERTEXT_VERSION);
let mut buf =
vec![Self::CIPHERTEXT_VERSION << 4 | Self::CIPHERTEXT_VERSION];
crate::proto::UnidentifiedSenderMessage {
ephemeral_public: Some(
self.ephemeral.to_bytes()?.as_slice().to_vec(),
Expand Down Expand Up @@ -294,12 +294,12 @@ impl SealedSessionCipher {
&content.into_bytes()?,
)?;

Ok(UnidentifiedSenderMessage {
UnidentifiedSenderMessage {
ephemeral: ephemeral.public(),
encrypted_static: static_key_ciphertext,
encrypted_message: message_bytes,
}
.into_bytes()?)
.into_bytes()
}

pub fn decrypt(
Expand Down

0 comments on commit cbc859e

Please sign in to comment.