diff --git a/Cargo.lock b/Cargo.lock index 71524af936906a35707562ba5083a9669892da28..75b1222ba59212d3532ef2b506a8edd7d155006f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,7 +372,7 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "conduit" -version = "0.4.0-next" +version = "0.5.0-alpha.next" dependencies = [ "async-trait", "axum", diff --git a/src/api/client_server/media.rs b/src/api/client_server/media.rs index ae023c95f85ee016ce6076439a401101ecd61b38..fa6def0bf30b4b86a47c1df23b5423245cf4b3e5 100644 --- a/src/api/client_server/media.rs +++ b/src/api/client_server/media.rs @@ -74,7 +74,7 @@ pub async fn get_remote_content( services() .media .create( - mxc.to_string(), + mxc.to_owned(), content_response.content_disposition.as_deref(), content_response.content_type.as_deref(), &content_response.file, diff --git a/src/config/mod.rs b/src/config/mod.rs index 3c3a764ab974060d1f01205fc2456ec09a2acb99..6b862bb67183af39ca2e0eba23ff6918bd49626e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -183,7 +183,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ("Turn TTL", &self.turn_ttl.to_string()), ("Turn URIs", { let mut lst = vec![]; - for item in self.turn_uris.to_vec().into_iter().enumerate() { + for item in self.turn_uris.iter().cloned().enumerate() { let (_, uri): (usize, String) = item; lst.push(uri); } @@ -191,7 +191,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { }), ]; - let mut msg: String = "Active config values:\n\n".to_string(); + let mut msg: String = "Active config values:\n\n".to_owned(); for line in lines.into_iter().enumerate() { msg += &format!("{}: {}\n", line.1 .0, line.1 .1); diff --git a/src/database/key_value/pusher.rs b/src/database/key_value/pusher.rs index b203107c4ec6fc01f2d0341a734aa1c55d2fcada..50a6faca7c2e44a23728bf9280a83b9ff1af2bd0 100644 --- a/src/database/key_value/pusher.rs +++ b/src/database/key_value/pusher.rs @@ -22,11 +22,10 @@ fn set_pusher(&self, sender: &UserId, pusher: set_pusher::v3::PusherAction) -> R let mut key = sender.as_bytes().to_vec(); key.push(0xff); key.extend_from_slice(ids.pushkey.as_bytes()); - return self - .senderkey_pusher + self.senderkey_pusher .remove(&key) .map(|_| ()) - .map_err(Into::into); + .map_err(Into::into) } } } diff --git a/src/lib.rs b/src/lib.rs index 3d7f7ae990830a1569b42444410f3d93f0274766..dc6a9d2fcc9667ceb2a65885ed8b449c3d0298df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ pub static SERVICES: RwLock<Option<&'static Services>> = RwLock::new(None); -pub fn services<'a>() -> &'static Services { +pub fn services() -> &'static Services { SERVICES .read() .unwrap() diff --git a/src/service/admin/mod.rs b/src/service/admin/mod.rs index 5766b2f285ead07b06038fa56bcc370cc4e17909..e2b2fd8dc600f5f137e276e9f9c1be2e66a10684 100644 --- a/src/service/admin/mod.rs +++ b/src/service/admin/mod.rs @@ -599,7 +599,8 @@ async fn process_admin_command( } } AdminCommand::CreateUser { username, password } => { - let password = password.unwrap_or(utils::random_string(AUTO_GEN_PASSWORD_LENGTH)); + let password = + password.unwrap_or_else(|| utils::random_string(AUTO_GEN_PASSWORD_LENGTH)); // Validate user id let user_id = match UserId::parse_with_server_name( username.as_str().to_lowercase(), @@ -732,9 +733,8 @@ async fn process_admin_command( } for &user_id in &user_ids { - match services().users.deactivate_account(user_id) { - Ok(_) => deactivation_count += 1, - Err(_) => {} + if services().users.deactivate_account(user_id).is_ok() { + deactivation_count += 1 } } diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index cd11d71f5612a4a191f8ac0a8045c482043e2149..d3d157c753f43f4ac0610f75b5842a9c131ccb3f 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -42,7 +42,7 @@ pub fn get_pushers(&self, sender: &UserId) -> Result<Vec<Pusher>> { self.db.get_pushers(sender) } - pub fn get_pushkeys<'a>(&'a self, sender: &UserId) -> Box<dyn Iterator<Item = Result<String>>> { + pub fn get_pushkeys(&self, sender: &UserId) -> Box<dyn Iterator<Item = Result<String>>> { self.db.get_pushkeys(sender) } @@ -296,8 +296,8 @@ async fn send_notice( Ok(()) } // TODO: Handle email - PusherKind::Email(_) => return Ok(()), - _ => return Ok(()), + PusherKind::Email(_) => Ok(()), + _ => Ok(()), } } } diff --git a/src/service/rooms/search/data.rs b/src/service/rooms/search/data.rs index 82c0800431504bfcdcfeadea1ada9cee7244e654..6eef38fbe90bad602a0a98dbb79eb6f53ac31560 100644 --- a/src/service/rooms/search/data.rs +++ b/src/service/rooms/search/data.rs @@ -2,7 +2,7 @@ use ruma::RoomId; pub trait Data: Send + Sync { - fn index_pdu<'a>(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()>; + fn index_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()>; fn search_pdus<'a>( &'a self, diff --git a/src/service/rooms/state/data.rs b/src/service/rooms/state/data.rs index f52ea72bea049c485535eac436531f67a90298f0..96116b02ca87d7c93b23d9e0fa2c4eb77ceac693 100644 --- a/src/service/rooms/state/data.rs +++ b/src/service/rooms/state/data.rs @@ -22,7 +22,7 @@ fn set_room_state( fn get_forward_extremities(&self, room_id: &RoomId) -> Result<HashSet<Arc<EventId>>>; /// Replace the forward extremities of the room. - fn set_forward_extremities<'a>( + fn set_forward_extremities( &self, room_id: &RoomId, event_ids: Vec<OwnedEventId>, diff --git a/src/service/rooms/state/mod.rs b/src/service/rooms/state/mod.rs index 0e4503229ab8606ef9bb8d87780a765213f46adb..3072b80fb2e8abbe339e7afe8655f2c4b83e6233 100644 --- a/src/service/rooms/state/mod.rs +++ b/src/service/rooms/state/mod.rs @@ -343,7 +343,7 @@ pub fn get_forward_extremities(&self, room_id: &RoomId) -> Result<HashSet<Arc<Ev self.db.get_forward_extremities(room_id) } - pub fn set_forward_extremities<'a>( + pub fn set_forward_extremities( &self, room_id: &RoomId, event_ids: Vec<OwnedEventId>, diff --git a/src/service/rooms/user/mod.rs b/src/service/rooms/user/mod.rs index 2266d97a1b115df81700923c66fa25f27a10292b..672e502d9db7745964359fe0d1c54f7c075d703e 100644 --- a/src/service/rooms/user/mod.rs +++ b/src/service/rooms/user/mod.rs @@ -40,10 +40,10 @@ pub fn get_token_shortstatehash(&self, room_id: &RoomId, token: u64) -> Result<O self.db.get_token_shortstatehash(room_id, token) } - pub fn get_shared_rooms<'a>( - &'a self, + pub fn get_shared_rooms( + &self, users: Vec<OwnedUserId>, - ) -> Result<impl Iterator<Item = Result<OwnedRoomId>> + 'a> { + ) -> Result<impl Iterator<Item = Result<OwnedRoomId>>> { self.db.get_shared_rooms(users) } }