resolve the last few relevant pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
fa71dd4b4c
commit
48d1a3af3c
20 changed files with 464 additions and 560 deletions
|
@ -314,9 +314,8 @@ impl Service {
|
|||
Ok(ruma::signatures::Verified::Signatures) => {
|
||||
// Redact
|
||||
warn!("Calculated hash does not match: {}", event_id);
|
||||
let obj = match ruma::canonical_json::redact(value, room_version_id, None) {
|
||||
Ok(obj) => obj,
|
||||
Err(_) => return Err(Error::BadRequest(ErrorKind::InvalidParam, "Redaction failed")),
|
||||
let Ok(obj) = ruma::canonical_json::redact(value, room_version_id, None) else {
|
||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Redaction failed"));
|
||||
};
|
||||
|
||||
// Skip the PDU if it is redacted and we already have it as an outlier event
|
||||
|
@ -373,12 +372,9 @@ impl Service {
|
|||
// Build map of auth events
|
||||
let mut auth_events = HashMap::new();
|
||||
for id in &incoming_pdu.auth_events {
|
||||
let auth_event = match services().rooms.timeline.get_pdu(id)? {
|
||||
Some(e) => e,
|
||||
None => {
|
||||
warn!("Could not find auth event {}", id);
|
||||
continue;
|
||||
},
|
||||
let Some(auth_event) = services().rooms.timeline.get_pdu(id)? else {
|
||||
warn!("Could not find auth event {}", id);
|
||||
continue;
|
||||
};
|
||||
|
||||
self.check_room_id(room_id, &auth_event)?;
|
||||
|
@ -525,20 +521,16 @@ impl Service {
|
|||
|
||||
let mut okay = true;
|
||||
for prev_eventid in &incoming_pdu.prev_events {
|
||||
let prev_event = if let Ok(Some(pdu)) = services().rooms.timeline.get_pdu(prev_eventid) {
|
||||
pdu
|
||||
} else {
|
||||
let Ok(Some(prev_event)) = services().rooms.timeline.get_pdu(prev_eventid) else {
|
||||
okay = false;
|
||||
break;
|
||||
};
|
||||
|
||||
let sstatehash = if let Ok(Some(s)) = services()
|
||||
let Ok(Some(sstatehash)) = services()
|
||||
.rooms
|
||||
.state_accessor
|
||||
.pdu_shortstatehash(prev_eventid)
|
||||
{
|
||||
s
|
||||
} else {
|
||||
else {
|
||||
okay = false;
|
||||
break;
|
||||
};
|
||||
|
@ -1072,14 +1064,12 @@ impl Service {
|
|||
{
|
||||
Ok(res) => {
|
||||
info!("Got {} over federation", next_id);
|
||||
let (calculated_event_id, value) =
|
||||
match pdu::gen_event_id_canonical_json(&res.pdu, room_version_id) {
|
||||
Ok(t) => t,
|
||||
Err(_) => {
|
||||
back_off((*next_id).to_owned()).await;
|
||||
continue;
|
||||
},
|
||||
};
|
||||
let Ok((calculated_event_id, value)) =
|
||||
pdu::gen_event_id_canonical_json(&res.pdu, room_version_id)
|
||||
else {
|
||||
back_off((*next_id).to_owned()).await;
|
||||
continue;
|
||||
};
|
||||
|
||||
if calculated_event_id != *next_id {
|
||||
warn!(
|
||||
|
@ -1616,21 +1606,18 @@ impl Service {
|
|||
|
||||
/// Returns Ok if the acl allows the server
|
||||
pub fn acl_check(&self, server_name: &ServerName, room_id: &RoomId) -> Result<()> {
|
||||
let acl_event =
|
||||
match services()
|
||||
let acl_event = if let Some(acl) =
|
||||
services()
|
||||
.rooms
|
||||
.state_accessor
|
||||
.room_state_get(room_id, &StateEventType::RoomServerAcl, "")?
|
||||
{
|
||||
Some(acl) => {
|
||||
debug!("ACL event found: {acl:?}");
|
||||
acl
|
||||
},
|
||||
None => {
|
||||
info!("No ACL event found");
|
||||
return Ok(());
|
||||
},
|
||||
};
|
||||
{
|
||||
debug!("ACL event found: {acl:?}");
|
||||
acl
|
||||
} else {
|
||||
debug!("No ACL event found");
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let acl_event_content: RoomServerAclEventContent = match serde_json::from_str(acl_event.content.get()) {
|
||||
Ok(content) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue