Remove redundant calls to .iter() and .into_iter()
parent
dbe8c2ce19
commit
dc031fff95
|
@ -531,7 +531,7 @@ impl Rooms {
|
||||||
self.roomid_pduleaves.remove(key?)?;
|
self.roomid_pduleaves.remove(key?)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
for event_id in event_ids.iter() {
|
for event_id in event_ids {
|
||||||
let mut key = prefix.to_owned();
|
let mut key = prefix.to_owned();
|
||||||
key.extend_from_slice(event_id.as_bytes());
|
key.extend_from_slice(event_id.as_bytes());
|
||||||
self.roomid_pduleaves.insert(&key, event_id.as_bytes())?;
|
self.roomid_pduleaves.insert(&key, event_id.as_bytes())?;
|
||||||
|
|
|
@ -552,7 +552,7 @@ pub async fn send_transaction_message_route<'a>(
|
||||||
// events that it references.
|
// events that it references.
|
||||||
let mut auth_cache = EventMap::new();
|
let mut auth_cache = EventMap::new();
|
||||||
|
|
||||||
for pdu in body.pdus.iter() {
|
for pdu in &body.pdus {
|
||||||
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
||||||
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu) {
|
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
|
@ -757,7 +757,7 @@ fn handle_incoming_pdu<'a>(
|
||||||
|
|
||||||
// Build map of auth events
|
// Build map of auth events
|
||||||
let mut auth_events = BTreeMap::new();
|
let mut auth_events = BTreeMap::new();
|
||||||
for id in incoming_pdu.auth_events.iter() {
|
for id in &incoming_pdu.auth_events {
|
||||||
let auth_event = auth_cache.get(id).ok_or_else(|| {
|
let auth_event = auth_cache.get(id).ok_or_else(|| {
|
||||||
"Auth event not found, event failed recursive auth checks.".to_string()
|
"Auth event not found, event failed recursive auth checks.".to_string()
|
||||||
})?;
|
})?;
|
||||||
|
@ -869,7 +869,7 @@ fn handle_incoming_pdu<'a>(
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut state = BTreeMap::new();
|
let mut state = BTreeMap::new();
|
||||||
for pdu in state_vec.into_iter() {
|
for pdu in state_vec {
|
||||||
match state.entry((pdu.kind.clone(), pdu.state_key.clone().ok_or_else(|| "Found non-state pdu in state events.".to_owned())?)) {
|
match state.entry((pdu.kind.clone(), pdu.state_key.clone().ok_or_else(|| "Found non-state pdu in state events.".to_owned())?)) {
|
||||||
Entry::Vacant(v) => {
|
Entry::Vacant(v) => {
|
||||||
v.insert(pdu);
|
v.insert(pdu);
|
||||||
|
@ -1268,7 +1268,7 @@ pub(crate) async fn fetch_signing_keys(
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug!("Got signing keys: {:?}", keys);
|
debug!("Got signing keys: {:?}", keys);
|
||||||
for k in keys.server_keys.into_iter() {
|
for k in keys.server_keys {
|
||||||
db.globals.add_signing_key(origin, &k)?;
|
db.globals.add_signing_key(origin, &k)?;
|
||||||
result.extend(
|
result.extend(
|
||||||
k.verify_keys
|
k.verify_keys
|
||||||
|
|
Loading…
Reference in New Issue