fix: remove warnings

This commit is contained in:
Timo Kösters 2022-04-07 13:22:10 +02:00
parent 2808dd2000
commit df4c38cb61
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
13 changed files with 14 additions and 68 deletions

View file

@ -18,7 +18,7 @@ use ruma::{
events::{
room::member::{MembershipState, RoomMemberEventContent},
room::message::RoomMessageEventContent,
GlobalAccountDataEventType, RoomAccountDataEventType, RoomEventType,
GlobalAccountDataEventType, RoomEventType,
},
push, UserId,
};

View file

@ -1,7 +1,7 @@
use crate::{database::DatabaseGuard, Error, Result, Ruma};
use ruma::{
api::client::{context::get_context, error::ErrorKind, filter::LazyLoadOptions},
events::{EventType, StateEventType},
events::StateEventType,
};
use std::{collections::HashSet, convert::TryFrom};
use tracing::error;

View file

@ -828,14 +828,6 @@ pub(crate) async fn invite_helper<'a>(
})
.transpose()?;
let create_prev_event = if prev_events.len() == 1
&& Some(&prev_events[0]) == create_event.as_ref().map(|c| &c.event_id)
{
create_event
} else {
None
};
// If there was no create event yet, assume we are creating a version 6 room right now
let room_version_id = create_event_content
.map_or(RoomVersionId::V6, |create_event| create_event.room_version);

View file

@ -8,9 +8,7 @@ use ruma::{
set_pushrule_enabled, RuleKind,
},
},
events::{
push_rules::PushRulesEvent, EventType, GlobalAccountDataEventType, RoomAccountDataEventType,
},
events::{push_rules::PushRulesEvent, GlobalAccountDataEventType},
push::{ConditionalPushRuleInit, PatternedPushRuleInit, SimplePushRuleInit},
};

View file

@ -13,7 +13,7 @@ use ruma::{
canonical_alias::RoomCanonicalAliasEventContent,
history_visibility::{HistoryVisibility, RoomHistoryVisibilityEventContent},
},
AnyStateEventContent, EventType, RoomEventType, StateEventType,
AnyStateEventContent, StateEventType,
},
serde::Raw,
EventId, RoomId, UserId,

View file

@ -7,7 +7,7 @@ use ruma::{
},
events::{
room::member::{MembershipState, RoomMemberEventContent},
EventType, RoomEventType, StateEventType,
RoomEventType, StateEventType,
},
serde::Raw,
DeviceId, RoomId, UserId,

View file

@ -3,7 +3,7 @@ use ruma::{
api::client::tag::{create_tag, delete_tag, get_tags},
events::{
tag::{TagEvent, TagEventContent},
EventType, RoomAccountDataEventType,
RoomAccountDataEventType,
},
};
use std::collections::BTreeMap;

View file

@ -7,7 +7,6 @@ use ruma::{
client::{error::ErrorKind, to_device::send_event_to_device},
federation::{self, transactions::edu::DirectDeviceContent},
},
events::EventType,
to_device::DeviceIdOrAllDevices,
};

View file

@ -19,7 +19,7 @@ thread_local! {
struct PreparedStatementIterator<'a> {
pub iterator: Box<dyn Iterator<Item = TupleOfBytes> + 'a>,
pub statement_ref: NonAliasingBox<rusqlite::Statement<'a>>,
pub _statement_ref: NonAliasingBox<rusqlite::Statement<'a>>,
}
impl Iterator for PreparedStatementIterator<'_> {
@ -184,7 +184,7 @@ impl SqliteTable {
Box::new(PreparedStatementIterator {
iterator,
statement_ref,
_statement_ref: statement_ref,
})
}
}
@ -283,7 +283,7 @@ impl Tree for SqliteTable {
);
Box::new(PreparedStatementIterator {
iterator,
statement_ref,
_statement_ref: statement_ref,
})
} else {
let statement = Box::leak(Box::new(
@ -309,7 +309,7 @@ impl Tree for SqliteTable {
Box::new(PreparedStatementIterator {
iterator,
statement_ref,
_statement_ref: statement_ref,
})
}
}

View file

@ -11,7 +11,7 @@ use ruma::{
},
events::{
room::{name::RoomNameEventContent, power_levels::RoomPowerLevelsEventContent},
AnySyncRoomEvent, EventType, RoomEventType, StateEventType,
AnySyncRoomEvent, RoomEventType, StateEventType,
},
push::{Action, PushConditionRoomCtx, PushFormat, Ruleset, Tweak},
serde::Raw,

View file

@ -1835,14 +1835,6 @@ impl Rooms {
})
.transpose()?;
let create_prev_event = if prev_events.len() == 1
&& Some(&prev_events[0]) == create_event.as_ref().map(|c| &c.event_id)
{
create_event
} else {
None
};
// If there was no create event yet, assume we are creating a version 6 room right now
let room_version_id = create_event_content
.map_or(RoomVersionId::V6, |create_event| create_event.room_version);
@ -1978,7 +1970,7 @@ impl Rooms {
self.room_servers(room_id).filter_map(|r| r.ok()).collect();
// In case we are kicking or banning a user, we need to inform their server of the change
if pdu.kind == EventType::RoomMember {
if pdu.kind == RoomEventType::RoomMember {
if let Some(state_key_uid) = &pdu
.state_key
.as_ref()
@ -2001,7 +1993,7 @@ impl Rooms {
// If the RoomMember event has a non-empty state_key, it is targeted at someone.
// If it is our appservice user, we send this PDU to it.
if pdu.kind == EventType::RoomMember {
if pdu.kind == RoomEventType::RoomMember {
if let Some(state_key_uid) = &pdu
.state_key
.as_ref()

View file

@ -23,10 +23,7 @@ use ruma::{
OutgoingRequest,
},
device_id,
events::{
push_rules::PushRulesEvent, AnySyncEphemeralRoomEvent, EventType,
GlobalAccountDataEventType,
},
events::{push_rules::PushRulesEvent, AnySyncEphemeralRoomEvent, GlobalAccountDataEventType},
push,
receipt::ReceiptType,
uint, MilliSecondsSinceUnixEpoch, ServerName, UInt, UserId,

View file

@ -1201,18 +1201,6 @@ fn handle_outlier_pdu<'a>(
return Err("Incoming event refers to wrong create event.".to_owned());
}
// If the previous event was the create event special rules apply
let previous_create = if incoming_pdu.auth_events.len() == 1
&& incoming_pdu.prev_events == incoming_pdu.auth_events
{
db.rooms
.get_pdu(&incoming_pdu.auth_events[0])
.map_err(|e| e.to_string())?
.filter(|maybe_create| **maybe_create == *create_event)
} else {
None
};
if !state_res::event_auth::auth_check(
&room_version,
&incoming_pdu,
@ -1498,18 +1486,6 @@ async fn upgrade_outlier_to_timeline_pdu(
state_at_incoming_event.expect("we always set this to some above");
// 11. Check the auth of the event passes based on the state of the event
// If the previous event was the create event special rules apply
let previous_create = if incoming_pdu.auth_events.len() == 1
&& incoming_pdu.prev_events == incoming_pdu.auth_events
{
db.rooms
.get_pdu(&incoming_pdu.auth_events[0])
.map_err(|e| e.to_string())?
.filter(|maybe_create| **maybe_create == *create_event)
} else {
None
};
let check_result = state_res::event_auth::auth_check(
&room_version,
&incoming_pdu,
@ -2635,14 +2611,6 @@ pub async fn create_join_event_template_route(
})
.transpose()?;
let create_prev_event = if prev_events.len() == 1
&& Some(&prev_events[0]) == create_event.as_ref().map(|c| &c.event_id)
{
create_event
} else {
None
};
// If there was no create event yet, assume we are creating a version 6 room right now
let room_version_id =
create_event_content.map_or(RoomVersionId::V6, |create_event| create_event.room_version);