Skip to content

Commit

Permalink
annotate individual implementations of traits with clippy exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
boxdot committed Sep 30, 2024
1 parent ddc3b79 commit f015dce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
26 changes: 24 additions & 2 deletions libsignal-service/examples/storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::diverging_sub_expression)]

use libsignal_service::pre_keys::{KyberPreKeyStoreExt, PreKeysStore};
use libsignal_service::protocol::{
Direction, IdentityKey, IdentityKeyPair, IdentityKeyStore, KyberPreKeyId,
Expand All @@ -18,6 +16,10 @@ impl ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl PreKeyStore for ExampleStore {
/// Look up the pre-key corresponding to `prekey_id`.
async fn get_pre_key(
Expand Down Expand Up @@ -46,6 +48,10 @@ impl PreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl KyberPreKeyStore for ExampleStore {
/// Look up the signed kyber pre-key corresponding to `kyber_prekey_id`.
async fn get_kyber_pre_key(
Expand Down Expand Up @@ -75,6 +81,10 @@ impl KyberPreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl SignedPreKeyStore for ExampleStore {
/// Look up the signed pre-key corresponding to `signed_prekey_id`.
async fn get_signed_pre_key(
Expand All @@ -95,6 +105,10 @@ impl SignedPreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl KyberPreKeyStoreExt for ExampleStore {
async fn store_last_resort_kyber_pre_key(
&mut self,
Expand Down Expand Up @@ -136,6 +150,10 @@ impl KyberPreKeyStoreExt for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl IdentityKeyStore for ExampleStore {
/// Return the single specific identity the store is assumed to represent, with private key.
async fn get_identity_key_pair(
Expand Down Expand Up @@ -191,6 +209,10 @@ impl IdentityKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"
)]
impl PreKeysStore for ExampleStore {
/// ID of the next pre key
async fn next_pre_key_id(&self) -> Result<u32, SignalProtocolError> {
Expand Down
7 changes: 5 additions & 2 deletions libsignal-service/src/messagepipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,16 @@ impl MessagePipe {
/// WebSocketService that panics on every request, mainly for example code.
pub struct PanicingWebSocketService;

#[allow(clippy::diverging_sub_expression)]
#[allow(
clippy::diverging_sub_expression,
reason = "combination of async_trait and todo"

Check failure on line 143 in libsignal-service/src/messagepipe.rs

View workflow job for this annotation

GitHub Actions / Build (libsignal-service-actix, Rust 1.75)

lint reasons are experimental
)]
#[cfg_attr(feature = "unsend-futures", async_trait::async_trait(?Send))]
#[cfg_attr(not(feature = "unsend-futures"), async_trait::async_trait)]
impl WebSocketService for PanicingWebSocketService {
type Stream = futures::channel::mpsc::Receiver<WebSocketStreamItem>;

async fn send_message(&mut self, _msg: Bytes) -> Result<(), ServiceError> {
unimplemented!();
todo!();
}
}

0 comments on commit f015dce

Please sign in to comment.