mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 04:13:03 +02:00
chore: Fix nightly-only clippy lints
This commit is contained in:
parent
baa89586e2
commit
72b78ed6d4
6 changed files with 24 additions and 33 deletions
|
@ -130,7 +130,7 @@ pub(crate) async fn get_context_route(
|
||||||
let state_at = events_after
|
let state_at = events_after
|
||||||
.last()
|
.last()
|
||||||
.map(ref_at!(1))
|
.map(ref_at!(1))
|
||||||
.map_or(body.event_id.as_ref(), |pdu| pdu.event_id.as_ref());
|
.map_or_else(|| body.event_id.as_ref(), |pdu| pdu.event_id.as_ref());
|
||||||
|
|
||||||
let state_ids = services
|
let state_ids = services
|
||||||
.rooms
|
.rooms
|
||||||
|
|
|
@ -27,5 +27,5 @@ fn init_user_agent() -> String { format!("{}/{}", name(), version()) }
|
||||||
|
|
||||||
fn init_version() -> String {
|
fn init_version() -> String {
|
||||||
conduwuit_build_metadata::version_tag()
|
conduwuit_build_metadata::version_tag()
|
||||||
.map_or(SEMANTIC.to_owned(), |extra| format!("{SEMANTIC} ({extra})"))
|
.map_or_else(|| SEMANTIC.to_owned(), |extra| format!("{SEMANTIC} ({extra})"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -585,10 +585,11 @@ where
|
||||||
(target_membership == MembershipState::Join).then_some(&power_levels.users_default)
|
(target_membership == MembershipState::Join).then_some(&power_levels.users_default)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut join_rules = JoinRule::Invite;
|
let join_rules = if let Some(jr) = &join_rules_event {
|
||||||
if let Some(jr) = &join_rules_event {
|
from_json_str::<RoomJoinRulesEventContent>(jr.content().get())?.join_rule
|
||||||
join_rules = from_json_str::<RoomJoinRulesEventContent>(jr.content().get())?.join_rule;
|
} else {
|
||||||
}
|
JoinRule::Invite
|
||||||
|
};
|
||||||
|
|
||||||
let power_levels_event_id = power_levels_event.as_ref().map(Event::event_id);
|
let power_levels_event_id = power_levels_event.as_ref().map(Event::event_id);
|
||||||
let sender_membership_event_id = sender_membership_event.as_ref().map(Event::event_id);
|
let sender_membership_event_id = sender_membership_event.as_ref().map(Event::event_id);
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl BoolExt for bool {
|
||||||
fn into_option(self) -> Option<()> { self.then_some(()) }
|
fn into_option(self) -> Option<()> { self.then_some(()) }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn into_result(self) -> Result<(), ()> { self.ok_or(()) }
|
fn into_result(self) -> Result<(), ()> { BoolExt::ok_or(self, ()) }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
|
fn map<T, F: FnOnce(Self) -> T>(self, f: F) -> T
|
||||||
|
@ -77,7 +77,7 @@ impl BoolExt for bool {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E> {
|
fn map_ok_or<T, E, F: FnOnce() -> T>(self, err: E, f: F) -> Result<T, E> {
|
||||||
self.ok_or(err).map(|()| f())
|
BoolExt::ok_or(self, err).map(|()| f())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -29,20 +29,19 @@ impl crate::Service for Service {
|
||||||
let db = Data::new(&args);
|
let db = Data::new(&args);
|
||||||
let config = &args.server.config;
|
let config = &args.server.config;
|
||||||
|
|
||||||
let turn_secret =
|
let turn_secret = config.turn_secret_file.as_ref().map_or_else(
|
||||||
config
|
|| config.turn_secret.clone(),
|
||||||
.turn_secret_file
|
|path| {
|
||||||
.as_ref()
|
std::fs::read_to_string(path).unwrap_or_else(|e| {
|
||||||
.map_or(config.turn_secret.clone(), |path| {
|
error!("Failed to read the TURN secret file: {e}");
|
||||||
std::fs::read_to_string(path).unwrap_or_else(|e| {
|
|
||||||
error!("Failed to read the TURN secret file: {e}");
|
|
||||||
|
|
||||||
config.turn_secret.clone()
|
config.turn_secret.clone()
|
||||||
})
|
})
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
let registration_token = config.registration_token_file.as_ref().map_or(
|
let registration_token = config.registration_token_file.as_ref().map_or_else(
|
||||||
config.registration_token.clone(),
|
|| config.registration_token.clone(),
|
||||||
|path| {
|
|path| {
|
||||||
let Ok(token) = std::fs::read_to_string(path).inspect_err(|e| {
|
let Ok(token) = std::fs::read_to_string(path).inspect_err(|e| {
|
||||||
error!("Failed to read the registration token file: {e}");
|
error!("Failed to read the registration token file: {e}");
|
||||||
|
|
|
@ -439,13 +439,7 @@ impl Service {
|
||||||
notifi.counts = NotificationCounts::default();
|
notifi.counts = NotificationCounts::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
if event_id_only {
|
if !event_id_only {
|
||||||
self.send_request(
|
|
||||||
&http.url,
|
|
||||||
send_event_notification::v1::Request::new(notifi),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
} else {
|
|
||||||
if *event.kind() == TimelineEventType::RoomEncrypted
|
if *event.kind() == TimelineEventType::RoomEncrypted
|
||||||
|| tweaks
|
|| tweaks
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -480,14 +474,11 @@ impl Service {
|
||||||
.get_canonical_alias(event.room_id())
|
.get_canonical_alias(event.room_id())
|
||||||
.await
|
.await
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
self.send_request(
|
|
||||||
&http.url,
|
|
||||||
send_event_notification::v1::Request::new(notifi),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.send_request(&http.url, send_event_notification::v1::Request::new(notifi))
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
// TODO: Handle email
|
// TODO: Handle email
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue