Skip to content

Commit

Permalink
Merge pull request #354 from whisperfish/profile-demo-code
Browse files Browse the repository at this point in the history
Fix profile demo code
  • Loading branch information
rubdos authored Feb 8, 2025
2 parents 43aa16f + ac37a81 commit 5005ed5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/groups_v2/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<C: CredentialsCache> GroupsManager<C> {
.await?;
self.credentials_cache
.write(credentials_response.parse()?)?;
self.credentials_cache.get(&today)?.ok_or_else(|| {
self.credentials_cache.get(&today)?.ok_or({
ServiceError::InvalidFrame {
reason:
"credentials received did not contain requested day",
Expand Down
4 changes: 2 additions & 2 deletions src/profile_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use crate::{
/// given_name: "Bill",
/// family_name: None,
/// };
/// let cipher = ProfileCipher::from(profile_key);
/// let encrypted = cipher.encrypt_name(&name).unwrap();
/// let cipher = ProfileCipher::new(profile_key);
/// let encrypted = cipher.encrypt_name(&name, &mut rng).unwrap();
/// let decrypted = cipher.decrypt_name(&encrypted).unwrap().unwrap();
/// assert_eq!(decrypted.as_ref(), name);
/// ```
Expand Down
6 changes: 3 additions & 3 deletions src/push_service/cdn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl PushService {
.await?
.headers()
.get("location")
.ok_or_else(|| ServiceError::InvalidFrame {
.ok_or(ServiceError::InvalidFrame {
reason: "missing location header in HTTP response",
})?
.to_str()
Expand Down Expand Up @@ -195,9 +195,9 @@ impl PushService {
.map_err(|_| ServiceError::InvalidFrame {
reason: "invalid format for Range HTTP header",
})?
.split("-")
.split('-')
.nth(1)
.ok_or_else(|| ServiceError::InvalidFrame {
.ok_or(ServiceError::InvalidFrame {
reason:
"invalid value format for Range HTTP header",
})?
Expand Down
2 changes: 1 addition & 1 deletion src/websocket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl SignalWebSocketProcess {
futures::select! {
_ = ka_interval.tick().fuse() => {
use prost::Message;
if self.outgoing_keep_alive_set.len() > 0 {
if !self.outgoing_keep_alive_set.is_empty() {
tracing::warn!("Websocket will be closed due to failed keepalives.");
if let Err(e) = self.ws.close(reqwest_websocket::CloseCode::Away, None).await {
tracing::debug!("Could not close WebSocket: {:?}", e);
Expand Down

0 comments on commit 5005ed5

Please sign in to comment.