Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix clippy 1.81 #323

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions libsignal-service-hyper/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,15 @@ impl PushService for HyperPushService {
}

#[tracing::instrument(skip(self, value, file), fields(file = file.as_ref().map(|_| "")))]
async fn post_to_cdn0<'s, C: io::Read + Send + 's>(
async fn post_to_cdn0<'s, C>(
&mut self,
path: &str,
value: &[(&str, &str)],
file: Option<(&str, &'s mut C)>,
) -> Result<(), ServiceError> {
) -> Result<(), ServiceError>
where
C: io::Read + Send + 's,
{
let mut form = mpart_async::client::MultipartRequest::default();

// mpart-async has a peculiar ordering of the form items,
Expand Down
6 changes: 6 additions & 0 deletions libsignal-service/examples/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ impl ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(clippy::diverging_sub_expression)]
impl PreKeyStore for ExampleStore {
/// Look up the pre-key corresponding to `prekey_id`.
async fn get_pre_key(
Expand Down Expand Up @@ -44,6 +45,7 @@ impl PreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(clippy::diverging_sub_expression)]
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 @@ -73,6 +75,7 @@ impl KyberPreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(clippy::diverging_sub_expression)]
impl SignedPreKeyStore for ExampleStore {
/// Look up the signed pre-key corresponding to `signed_prekey_id`.
async fn get_signed_pre_key(
Expand All @@ -93,6 +96,7 @@ impl SignedPreKeyStore for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(clippy::diverging_sub_expression)]
impl KyberPreKeyStoreExt for ExampleStore {
async fn store_last_resort_kyber_pre_key(
&mut self,
Expand Down Expand Up @@ -134,6 +138,7 @@ impl KyberPreKeyStoreExt for ExampleStore {
}

#[async_trait::async_trait(?Send)]
#[allow(clippy::diverging_sub_expression)]
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 @@ -189,6 +194,7 @@ impl IdentityKeyStore for ExampleStore {
}

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

#[allow(clippy::diverging_sub_expression)]
boxdot marked this conversation as resolved.
Show resolved Hide resolved
#[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!();
}
}
21 changes: 15 additions & 6 deletions libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,14 @@ pub trait PushService: MaybeSend {
/// Upload larger file to CDN0 in legacy fashion, e.g. for attachments.
///
/// Implementations are allowed to *panic* when the Read instance throws an IO-Error
async fn post_to_cdn0<'s, C: std::io::Read + Send + 's>(
async fn post_to_cdn0<'s, C>(
&mut self,
path: &str,
value: &[(&str, &str)],
file: Option<(&str, &'s mut C)>,
) -> Result<(), ServiceError>;
) -> Result<(), ServiceError>
where
C: std::io::Read + Send + 's;

async fn ws(
&mut self,
Expand Down Expand Up @@ -851,11 +853,14 @@ pub trait PushService: MaybeSend {
/// Upload attachment to CDN
///
/// Returns attachment ID and the attachment digest
async fn upload_attachment<'s, C: std::io::Read + Send + 's>(
async fn upload_attachment<'s, C>(
&mut self,
attrs: &AttachmentV2UploadAttributes,
content: &'s mut C,
) -> Result<(u64, Vec<u8>), ServiceError> {
) -> Result<(u64, Vec<u8>), ServiceError>
where
C: std::io::Read + Send + 's,
{
let values = [
("acl", &attrs.acl as &str),
("key", &attrs.key),
Expand Down Expand Up @@ -1081,15 +1086,19 @@ pub trait PushService: MaybeSend {
/// See [`AccountManager`][struct@crate::AccountManager] for a convenience method.
///
/// Java equivalent: `writeProfile`
async fn write_profile<'s, C: std::io::Read + Send + 's, S: AsRef<str>>(
async fn write_profile<'s, C, S>(
&mut self,
version: &ProfileKeyVersion,
name: &[u8],
about: &[u8],
emoji: &[u8],
commitment: &ProfileKeyCommitment,
avatar: AvatarWrite<&mut C>,
) -> Result<Option<String>, ServiceError> {
) -> Result<Option<String>, ServiceError>
where
C: std::io::Read + Send + 's,
S: AsRef<str>,
{
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct SignalServiceProfileWrite<'s> {
Expand Down
Loading