mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
enable semicolon_if_nothing_returned lint
This commit is contained in:
parent
96e1877639
commit
db4951c5fd
14 changed files with 27 additions and 26 deletions
|
|
@ -66,6 +66,7 @@ redundant_type_annotations = "warn"
|
||||||
ref_patterns = "warn"
|
ref_patterns = "warn"
|
||||||
rest_pat_in_fully_bound_structs = "warn"
|
rest_pat_in_fully_bound_structs = "warn"
|
||||||
same_name_method = "warn"
|
same_name_method = "warn"
|
||||||
|
semicolon_if_nothing_returned = "warn"
|
||||||
semicolon_inside_block = "warn"
|
semicolon_inside_block = "warn"
|
||||||
str_to_string = "warn"
|
str_to_string = "warn"
|
||||||
string_add = "warn"
|
string_add = "warn"
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ pub(crate) async fn add_backup_keys_route(
|
||||||
room_id,
|
room_id,
|
||||||
session_id,
|
session_id,
|
||||||
key_data,
|
key_data,
|
||||||
)?
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,7 +191,7 @@ pub(crate) async fn add_backup_keys_for_room_route(
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
session_id,
|
session_id,
|
||||||
key_data,
|
key_data,
|
||||||
)?
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(add_backup_keys_for_room::v3::Response {
|
Ok(add_backup_keys_for_room::v3::Response {
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ pub(crate) async fn delete_devices_route(
|
||||||
}
|
}
|
||||||
|
|
||||||
for device_id in &body.devices {
|
for device_id in &body.devices {
|
||||||
services().users.remove_device(sender_user, device_id)?
|
services().users.remove_device(sender_user, device_id)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(delete_devices::v3::Response {})
|
Ok(delete_devices::v3::Response {})
|
||||||
|
|
|
||||||
|
|
@ -1177,7 +1177,7 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
sender_user.clone(),
|
sender_user.clone(),
|
||||||
sender_device.clone(),
|
sender_device.clone(),
|
||||||
conn_id.clone(),
|
conn_id.clone(),
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ pub(crate) async fn send_event_to_device_route(
|
||||||
event.deserialize_as().map_err(|_| {
|
event.deserialize_as().map_err(|_| {
|
||||||
Error::BadRequest(ErrorKind::InvalidParam, "Event is invalid")
|
Error::BadRequest(ErrorKind::InvalidParam, "Event is invalid")
|
||||||
})?,
|
})?,
|
||||||
)?
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceIdOrAllDevices::AllDevices => {
|
DeviceIdOrAllDevices::AllDevices => {
|
||||||
|
|
|
||||||
|
|
@ -873,7 +873,7 @@ pub(crate) async fn send_transaction_message_route(
|
||||||
"Event is invalid",
|
"Event is invalid",
|
||||||
)
|
)
|
||||||
})?,
|
})?,
|
||||||
)?
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceIdOrAllDevices::AllDevices => {
|
DeviceIdOrAllDevices::AllDevices => {
|
||||||
|
|
@ -1830,11 +1830,11 @@ pub(crate) async fn get_profile_information_route(
|
||||||
|
|
||||||
match &body.field {
|
match &body.field {
|
||||||
Some(ProfileField::DisplayName) => {
|
Some(ProfileField::DisplayName) => {
|
||||||
displayname = services().users.displayname(&body.user_id)?
|
displayname = services().users.displayname(&body.user_id)?;
|
||||||
}
|
}
|
||||||
Some(ProfileField::AvatarUrl) => {
|
Some(ProfileField::AvatarUrl) => {
|
||||||
avatar_url = services().users.avatar_url(&body.user_id)?;
|
avatar_url = services().users.avatar_url(&body.user_id)?;
|
||||||
blurhash = services().users.blurhash(&body.user_id)?
|
blurhash = services().users.blurhash(&body.user_id)?;
|
||||||
}
|
}
|
||||||
// TODO: what to do with custom
|
// TODO: what to do with custom
|
||||||
Some(_) => {}
|
Some(_) => {}
|
||||||
|
|
@ -1938,7 +1938,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
add_port_to_hostname("example.com"),
|
add_port_to_hostname("example.com"),
|
||||||
FedDest::Named(String::from("example.com"), String::from(":8448"))
|
FedDest::Named(String::from("example.com"), String::from(":8448"))
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -1946,6 +1946,6 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
add_port_to_hostname("example.com:1337"),
|
add_port_to_hostname("example.com:1337"),
|
||||||
FedDest::Named(String::from("example.com"), String::from(":1337"))
|
FedDest::Named(String::from("example.com"), String::from(":1337"))
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ impl PartialProxyConfig {
|
||||||
let mut excluded_because = None; // most specific reason it was excluded
|
let mut excluded_because = None; // most specific reason it was excluded
|
||||||
if self.include.is_empty() {
|
if self.include.is_empty() {
|
||||||
// treat empty include list as `*`
|
// treat empty include list as `*`
|
||||||
included_because = Some(&WildCardedDomain::WildCard)
|
included_because = Some(&WildCardedDomain::WildCard);
|
||||||
}
|
}
|
||||||
for wc_domain in &self.include {
|
for wc_domain in &self.include {
|
||||||
if wc_domain.matches(domain) {
|
if wc_domain.matches(domain) {
|
||||||
|
|
|
||||||
|
|
@ -964,7 +964,7 @@ impl KeyValueDatabase {
|
||||||
error!(
|
error!(
|
||||||
"Could not set the configured emergency password for the grapevine user: {}",
|
"Could not set the configured emergency password for the grapevine user: {}",
|
||||||
e
|
e
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,9 @@ impl service::sending::Data for KeyValueDatabase {
|
||||||
for (outgoing_kind, event) in requests {
|
for (outgoing_kind, event) in requests {
|
||||||
let mut key = outgoing_kind.get_prefix();
|
let mut key = outgoing_kind.get_prefix();
|
||||||
if let SendingEventType::Pdu(value) = &event {
|
if let SendingEventType::Pdu(value) = &event {
|
||||||
key.extend_from_slice(value)
|
key.extend_from_slice(value);
|
||||||
} else {
|
} else {
|
||||||
key.extend_from_slice(&services().globals.next_count()?.to_be_bytes())
|
key.extend_from_slice(&services().globals.next_count()?.to_be_bytes());
|
||||||
}
|
}
|
||||||
let value = if let SendingEventType::Edu(value) = &event {
|
let value = if let SendingEventType::Edu(value) = &event {
|
||||||
&**value
|
&**value
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ async fn run_server() -> io::Result<()> {
|
||||||
sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
|
sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
|
||||||
.expect("should be able to notify systemd");
|
.expect("should be able to notify systemd");
|
||||||
|
|
||||||
server.await?
|
server.await?;
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let server = bind(addr).handle(handle).serve(app);
|
let server = bind(addr).handle(handle).serve(app);
|
||||||
|
|
@ -239,7 +239,7 @@ async fn run_server() -> io::Result<()> {
|
||||||
sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
|
sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
|
||||||
.expect("should be able to notify systemd");
|
.expect("should be able to notify systemd");
|
||||||
|
|
||||||
server.await?
|
server.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -699,11 +699,11 @@ impl Service {
|
||||||
match <&UserId>::try_from(user) {
|
match <&UserId>::try_from(user) {
|
||||||
Ok(user_id) => {
|
Ok(user_id) => {
|
||||||
if user_id.server_name() != services().globals.server_name() {
|
if user_id.server_name() != services().globals.server_name() {
|
||||||
remote_ids.push(user_id)
|
remote_ids.push(user_id);
|
||||||
} else if !services().users.exists(user_id)? {
|
} else if !services().users.exists(user_id)? {
|
||||||
non_existant_ids.push(user_id)
|
non_existant_ids.push(user_id);
|
||||||
} else {
|
} else {
|
||||||
user_ids.push(user_id)
|
user_ids.push(user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
|
@ -773,12 +773,12 @@ impl Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for &user_id in &user_ids {
|
for &user_id in &user_ids {
|
||||||
if services().users.deactivate_account(user_id).is_ok() {
|
if services().users.deactivate_account(user_id).is_ok() {
|
||||||
deactivation_count += 1
|
deactivation_count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ impl Service {
|
||||||
.iter()
|
.iter()
|
||||||
.any(|t| matches!(t, Tweak::Highlight(true) | Tweak::Sound(_)))
|
.any(|t| matches!(t, Tweak::Highlight(true) | Tweak::Sound(_)))
|
||||||
{
|
{
|
||||||
notifi.prio = NotificationPriority::High
|
notifi.prio = NotificationPriority::High;
|
||||||
}
|
}
|
||||||
|
|
||||||
if event_id_only {
|
if event_id_only {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ impl Service {
|
||||||
e.insert((Instant::now(), 1));
|
e.insert((Instant::now(), 1));
|
||||||
}
|
}
|
||||||
hash_map::Entry::Occupied(mut e) => {
|
hash_map::Entry::Occupied(mut e) => {
|
||||||
*e.get_mut() = (Instant::now(), e.get().1 + 1)
|
*e.get_mut() = (Instant::now(), e.get().1 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -243,7 +243,7 @@ impl Service {
|
||||||
e.insert((Instant::now(), 1));
|
e.insert((Instant::now(), 1));
|
||||||
}
|
}
|
||||||
hash_map::Entry::Occupied(mut e) => {
|
hash_map::Entry::Occupied(mut e) => {
|
||||||
*e.get_mut() = (Instant::now(), e.get().1 + 1)
|
*e.get_mut() = (Instant::now(), e.get().1 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1094,7 +1094,7 @@ impl Service {
|
||||||
e.insert((Instant::now(), 1));
|
e.insert((Instant::now(), 1));
|
||||||
}
|
}
|
||||||
hash_map::Entry::Occupied(mut e) => {
|
hash_map::Entry::Occupied(mut e) => {
|
||||||
*e.get_mut() = (Instant::now(), e.get().1 + 1)
|
*e.get_mut() = (Instant::now(), e.get().1 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ impl Service {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
})?
|
})?
|
||||||
.to_room_event())
|
.to_room_event());
|
||||||
}
|
}
|
||||||
SendingEventType::Edu(_) => {
|
SendingEventType::Edu(_) => {
|
||||||
// Appservices don't need EDUs (?)
|
// Appservices don't need EDUs (?)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue