mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-12-04 20:08:10 +00:00
fix new lints; clippy::unnecessary-map-or
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
2a9bb1ce11
commit
58be22e695
|
@ -54,7 +54,7 @@ impl LogLevelReloadHandles {
|
|||
.lock()
|
||||
.expect("locked")
|
||||
.iter()
|
||||
.filter(|(name, _)| names.map_or(false, |names| names.contains(&name.as_str())))
|
||||
.filter(|(name, _)| names.is_some_and(|names| names.contains(&name.as_str())))
|
||||
.for_each(|(_, handle)| {
|
||||
_ = handle.reload(new_value.clone()).or_else(error::else_log);
|
||||
});
|
||||
|
|
|
@ -58,8 +58,5 @@ pub unsafe fn current_exe() -> Result<std::path::PathBuf> {
|
|||
/// accurate on all platforms; defaults to false.
|
||||
#[must_use]
|
||||
pub fn current_exe_deleted() -> bool {
|
||||
std::env::current_exe().map_or(false, |exe| {
|
||||
exe.to_str()
|
||||
.map_or(false, |exe| exe.ends_with(" (deleted)"))
|
||||
})
|
||||
std::env::current_exe().is_ok_and(|exe| exe.to_str().is_some_and(|exe| exe.ends_with(" (deleted)")))
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ async fn handle_media_check(
|
|||
let old_is_symlink = || async {
|
||||
tokio::fs::symlink_metadata(old_path)
|
||||
.await
|
||||
.map_or(false, |md| md.is_symlink())
|
||||
.is_ok_and(|md| md.is_symlink())
|
||||
};
|
||||
|
||||
if config.prune_missing_media && !old_exists && !new_exists {
|
||||
|
|
|
@ -413,7 +413,7 @@ async fn retroactively_fix_bad_data_from_roomuserid_joined(services: &Services)
|
|||
.rooms
|
||||
.state_accessor
|
||||
.get_member(room_id, user_id)
|
||||
.map(|member| member.map_or(false, |member| member.membership == MembershipState::Join))
|
||||
.map(|member| member.is_ok_and(|member| member.membership == MembershipState::Join))
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.await;
|
||||
|
@ -426,7 +426,7 @@ async fn retroactively_fix_bad_data_from_roomuserid_joined(services: &Services)
|
|||
.rooms
|
||||
.state_accessor
|
||||
.get_member(room_id, user_id)
|
||||
.map(|member| member.map_or(false, |member| member.membership == MembershipState::Join))
|
||||
.map(|member| member.is_ok_and(|member| member.membership == MembershipState::Join))
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.await;
|
||||
|
|
|
@ -757,7 +757,7 @@ fn get_parent_children_via(
|
|||
fn next_room_to_traverse(
|
||||
stack: &mut Vec<Vec<(OwnedRoomId, Vec<OwnedServerName>)>>, parents: &mut VecDeque<OwnedRoomId>,
|
||||
) -> Option<(OwnedRoomId, Vec<OwnedServerName>)> {
|
||||
while stack.last().map_or(false, Vec::is_empty) {
|
||||
while stack.last().is_some_and(Vec::is_empty) {
|
||||
stack.pop();
|
||||
parents.pop_back();
|
||||
}
|
||||
|
|
|
@ -179,7 +179,6 @@ impl Data {
|
|||
}
|
||||
|
||||
/// Returns the full room state.
|
||||
#[allow(unused_qualifications)] // async traits
|
||||
pub(super) async fn room_state_full(
|
||||
&self, room_id: &RoomId,
|
||||
) -> Result<HashMap<(StateEventType, String), Arc<PduEvent>>> {
|
||||
|
|
|
@ -616,7 +616,7 @@ impl Service {
|
|||
&& pdu
|
||||
.state_key
|
||||
.as_ref()
|
||||
.map_or(false, |state_key| users.is_match(state_key))
|
||||
.is_some_and(|state_key| users.is_match(state_key))
|
||||
};
|
||||
let matching_aliases = |aliases: NamespaceRegex| {
|
||||
self.services
|
||||
|
|
|
@ -24,10 +24,7 @@ pub(super) fn get_prefix(&self) -> Vec<u8> {
|
|||
},
|
||||
Self::Appservice(server) => {
|
||||
let sigil = b"+";
|
||||
let len = sigil
|
||||
.len()
|
||||
.saturating_add(server.as_bytes().len())
|
||||
.saturating_add(1);
|
||||
let len = sigil.len().saturating_add(server.len()).saturating_add(1);
|
||||
|
||||
let mut p = Vec::with_capacity(len);
|
||||
p.extend_from_slice(sigil);
|
||||
|
@ -41,7 +38,7 @@ pub(super) fn get_prefix(&self) -> Vec<u8> {
|
|||
.len()
|
||||
.saturating_add(user.as_bytes().len())
|
||||
.saturating_add(1)
|
||||
.saturating_add(pushkey.as_bytes().len())
|
||||
.saturating_add(pushkey.len())
|
||||
.saturating_add(1);
|
||||
|
||||
let mut p = Vec::with_capacity(len);
|
||||
|
|
|
@ -101,7 +101,7 @@ impl Service {
|
|||
.account_data
|
||||
.get_global(recipient_user, GlobalAccountDataEventType::IgnoredUserList)
|
||||
.await
|
||||
.map_or(false, |ignored: IgnoredUserListEvent| {
|
||||
.is_ok_and(|ignored: IgnoredUserListEvent| {
|
||||
ignored
|
||||
.content
|
||||
.ignored_users
|
||||
|
|
Loading…
Reference in a new issue