From cf392145f0ce477c9ad0cfc428eda419f627f78e Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Mon, 24 Jun 2024 23:30:18 +0300 Subject: [PATCH] Clippy and format --- libsignal-service-hyper/src/websocket.rs | 4 ++-- libsignal-service/src/configuration.rs | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/libsignal-service-hyper/src/websocket.rs b/libsignal-service-hyper/src/websocket.rs index 8ec8777e6..d9ab6e677 100644 --- a/libsignal-service-hyper/src/websocket.rs +++ b/libsignal-service-hyper/src/websocket.rs @@ -85,12 +85,12 @@ impl From for ServiceError { // } // Process the WebSocket, until it times out. -async fn process( +async fn process( socket_stream: S, mut incoming_sink: Sender, ) -> Result<(), TungsteniteWebSocketError> where - S: Unpin, + S: Stream + Unpin, S: Stream>, { let mut socket_stream = socket_stream.fuse(); diff --git a/libsignal-service/src/configuration.rs b/libsignal-service/src/configuration.rs index fff3cc6eb..5d52b27df 100644 --- a/libsignal-service/src/configuration.rs +++ b/libsignal-service/src/configuration.rs @@ -1,4 +1,8 @@ -use std::{collections::HashMap, str::FromStr}; +use std::{ + collections::HashMap, + fmt::{Display, Error, Formatter}, + str::FromStr, +}; use crate::utils::BASE64_RELAXED; use base64::prelude::*; @@ -96,13 +100,16 @@ impl FromStr for SignalServers { } } -impl ToString for SignalServers { - fn to_string(&self) -> String { - match self { - Self::Staging => "staging", - Self::Production => "production", - } - .to_string() +impl Display for SignalServers { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> { + write!( + f, + "{}", + match self { + Self::Staging => "staging", + Self::Production => "production", + } + ) } }