style: make clippy happier

next
Timo Kösters 2020-10-07 12:29:19 +02:00
parent 4964e21342
commit 304c53c4f5
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
5 changed files with 7 additions and 11 deletions

View File

@ -354,12 +354,8 @@ pub async fn upgrade_room_route(
) -> ConduitResult<upgrade_room::Response> {
let sender_id = body.sender_id.as_ref().expect("user is authenticated");
// Validate the room version requested
let new_version =
RoomVersionId::try_from(body.new_version.clone()).expect("invalid room version id");
if !matches!(
new_version,
body.new_version,
RoomVersionId::Version5 | RoomVersionId::Version6
) {
return Err(Error::BadRequest(
@ -414,7 +410,7 @@ pub async fn upgrade_room_route(
let mut create_event_content =
ruma::events::room::create::CreateEventContent::new(sender_id.clone());
create_event_content.federate = federate;
create_event_content.room_version = new_version;
create_event_content.room_version = body.new_version.clone();
create_event_content.predecessor = predecessor;
db.rooms.build_and_append_pdu(

View File

@ -477,7 +477,7 @@ pub async fn sync_events_route(
})
.and_then(|pdu| {
serde_json::from_value::<Raw<ruma::events::room::member::MemberEventContent>>(
pdu.content.clone(),
pdu.content,
)
.expect("Raw::from_value always works")
.deserialize()

View File

@ -84,7 +84,7 @@ impl Sending {
(Box<ServerName>, send_transaction_message::v1::Response),
(Box<ServerName>, Error),
> {
let pdu_json = PduEvent::to_outgoing_federation_event(
let pdu_json = PduEvent::convert_to_outgoing_federation_event(
rooms
.get_pdu_json_from_id(&pdu_id)
.map_err(|e| (server.clone(), e))?

View File

@ -199,7 +199,7 @@ impl PduEvent {
serde_json::from_value(json).expect("Raw::from_value always works")
}
pub fn to_outgoing_federation_event(
pub fn convert_to_outgoing_federation_event(
mut pdu_json: serde_json::Value,
) -> Raw<ruma::events::pdu::PduStub> {
if let Some(unsigned) = pdu_json
@ -239,7 +239,7 @@ impl From<&state_res::StateEvent> for PduEvent {
content: pdu.content().clone(),
state_key: Some(pdu.state_key()),
prev_events: pdu.prev_event_ids(),
depth: pdu.depth().clone(),
depth: *pdu.depth(),
auth_events: pdu.auth_events(),
redacts: pdu.redacts().cloned(),
unsigned: pdu.unsigned().clone().into_iter().collect(),

View File

@ -438,7 +438,7 @@ pub fn get_missing_events_route<'a>(
)
.map_err(|_| Error::bad_database("Invalid prev_events content in pdu in db."))?,
);
events.push(PduEvent::to_outgoing_federation_event(pdu));
events.push(PduEvent::convert_to_outgoing_federation_event(pdu));
}
i += 1;
}