chore: get rid of warnings
This commit is contained in:
parent
e50f2864de
commit
16eed1d8c2
9 changed files with 82 additions and 96 deletions
|
@ -55,9 +55,7 @@ impl Appservice {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn iter_all<'a>(
|
||||
&'a self,
|
||||
) -> impl Iterator<Item = Result<(String, serde_yaml::Value)>> + 'a {
|
||||
pub fn iter_all(&self) -> impl Iterator<Item = Result<(String, serde_yaml::Value)>> + '_ {
|
||||
self.iter_ids().filter_map(|id| id.ok()).map(move |id| {
|
||||
Ok((
|
||||
id.clone(),
|
||||
|
|
|
@ -262,7 +262,7 @@ impl Media {
|
|||
}
|
||||
};
|
||||
|
||||
image.thumbnail_exact(dbg!(exact_width), dbg!(exact_height))
|
||||
image.thumbnail_exact(exact_width, exact_height)
|
||||
};
|
||||
|
||||
let mut thumbnail_bytes = Vec::new();
|
||||
|
|
|
@ -108,7 +108,6 @@ impl Rooms {
|
|||
|
||||
pub fn state_full(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
shortstatehash: u64,
|
||||
) -> Result<BTreeMap<(EventType, String), PduEvent>> {
|
||||
Ok(self
|
||||
|
@ -151,7 +150,6 @@ impl Rooms {
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub fn state_get(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
shortstatehash: u64,
|
||||
event_type: &EventType,
|
||||
state_key: &str,
|
||||
|
@ -257,11 +255,11 @@ impl Rooms {
|
|||
/// Generate a new StateHash.
|
||||
///
|
||||
/// A unique hash made from hashing all PDU ids of the state joined with 0xff.
|
||||
fn calculate_hash(&self, bytes_list: &[&[u8]]) -> Result<StateHashId> {
|
||||
fn calculate_hash(&self, bytes_list: &[&[u8]]) -> StateHashId {
|
||||
// We only hash the pdu's event ids, not the whole pdu
|
||||
let bytes = bytes_list.join(&0xff);
|
||||
let hash = digest::digest(&digest::SHA256, &bytes);
|
||||
Ok(hash.as_ref().into())
|
||||
hash.as_ref().into()
|
||||
}
|
||||
|
||||
/// Checks if a room exists.
|
||||
|
@ -291,7 +289,7 @@ impl Rooms {
|
|||
.values()
|
||||
.map(|event_id| event_id.as_bytes())
|
||||
.collect::<Vec<_>>(),
|
||||
)?;
|
||||
);
|
||||
|
||||
let shortstatehash = match self.statehash_shortstatehash.get(&state_hash)? {
|
||||
Some(shortstatehash) => {
|
||||
|
@ -353,7 +351,7 @@ impl Rooms {
|
|||
room_id: &RoomId,
|
||||
) -> Result<BTreeMap<(EventType, String), PduEvent>> {
|
||||
if let Some(current_shortstatehash) = self.current_shortstatehash(room_id)? {
|
||||
self.state_full(&room_id, current_shortstatehash)
|
||||
self.state_full(current_shortstatehash)
|
||||
} else {
|
||||
Ok(BTreeMap::new())
|
||||
}
|
||||
|
@ -368,7 +366,7 @@ impl Rooms {
|
|||
state_key: &str,
|
||||
) -> Result<Option<PduEvent>> {
|
||||
if let Some(current_shortstatehash) = self.current_shortstatehash(room_id)? {
|
||||
self.state_get(&room_id, current_shortstatehash, event_type, state_key)
|
||||
self.state_get(current_shortstatehash, event_type, state_key)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
|
@ -582,7 +580,7 @@ impl Rooms {
|
|||
{
|
||||
if let Some(shortstatehash) = self.pdu_shortstatehash(&pdu.event_id).unwrap() {
|
||||
if let Some(prev_state) = self
|
||||
.state_get(&pdu.room_id, shortstatehash, &pdu.kind, &state_key)
|
||||
.state_get(shortstatehash, &pdu.kind, &state_key)
|
||||
.unwrap()
|
||||
{
|
||||
unsigned.insert(
|
||||
|
@ -849,7 +847,7 @@ impl Rooms {
|
|||
.values()
|
||||
.map(|event_id| &**event_id)
|
||||
.collect::<Vec<_>>(),
|
||||
)?;
|
||||
);
|
||||
|
||||
let shortstatehash = match self.statehash_shortstatehash.get(&new_state_hash)? {
|
||||
Some(shortstatehash) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
convert::{TryFrom, TryInto},
|
||||
convert::TryFrom,
|
||||
fmt::Debug,
|
||||
sync::Arc,
|
||||
time::{Duration, Instant, SystemTime},
|
||||
|
@ -10,11 +10,11 @@ use crate::{
|
|||
appservice_server, database::pusher, server_server, utils, Database, Error, PduEvent, Result,
|
||||
};
|
||||
use federation::transactions::send_transaction_message;
|
||||
use log::{error, info, warn};
|
||||
use log::{info, warn};
|
||||
use ring::digest;
|
||||
use rocket::futures::stream::{FuturesUnordered, StreamExt};
|
||||
use ruma::{
|
||||
api::{appservice, client::r0::push::Pusher, federation, OutgoingRequest},
|
||||
api::{appservice, federation, OutgoingRequest},
|
||||
events::{push_rules, EventType},
|
||||
uint, ServerName, UInt, UserId,
|
||||
};
|
||||
|
@ -264,7 +264,7 @@ impl Sending {
|
|||
futures.push(
|
||||
Self::handle_event(
|
||||
outgoing_kind,
|
||||
vec![pdu_id.into()],
|
||||
vec![pdu_id],
|
||||
&db,
|
||||
)
|
||||
);
|
||||
|
@ -395,18 +395,19 @@ impl Sending {
|
|||
continue;
|
||||
}
|
||||
|
||||
let userid = UserId::try_from(utils::string_from_bytes(user).map_err(|e| {
|
||||
(
|
||||
OutgoingKind::Push(user.clone(), pushkey.clone()),
|
||||
Error::bad_database("Invalid push user string in db."),
|
||||
)
|
||||
})?)
|
||||
.map_err(|e| {
|
||||
(
|
||||
OutgoingKind::Push(user.clone(), pushkey.clone()),
|
||||
Error::bad_database("Invalid push user id in db."),
|
||||
)
|
||||
})?;
|
||||
let userid =
|
||||
UserId::try_from(utils::string_from_bytes(user).map_err(|_| {
|
||||
(
|
||||
OutgoingKind::Push(user.clone(), pushkey.clone()),
|
||||
Error::bad_database("Invalid push user string in db."),
|
||||
)
|
||||
})?)
|
||||
.map_err(|_| {
|
||||
(
|
||||
OutgoingKind::Push(user.clone(), pushkey.clone()),
|
||||
Error::bad_database("Invalid push user id in db."),
|
||||
)
|
||||
})?;
|
||||
|
||||
let mut senderkey = user.clone();
|
||||
senderkey.push(0xff);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue