From d144db8688c4e30a4dba9d14ff6bcc1a0bc7ce4a Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Sun, 12 May 2024 18:38:12 -0700 Subject: [PATCH] enable `ref_patterns` lint --- Cargo.toml | 1 + src/api/client_server/account.rs | 2 +- src/api/client_server/alias.rs | 4 ++-- src/api/client_server/room.rs | 4 ++-- src/api/client_server/session.rs | 6 +++--- src/api/server_server.rs | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 26086f8d..e00eb260 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ rc_buffer = "warn" rc_mutex = "warn" redundant_feature_names = "warn" redundant_type_annotations = "warn" +ref_patterns = "warn" rest_pat_in_fully_bound_structs = "warn" semicolon_inside_block = "warn" str_to_string = "warn" diff --git a/src/api/client_server/account.rs b/src/api/client_server/account.rs index 9c3d2083..2368ae92 100644 --- a/src/api/client_server/account.rs +++ b/src/api/client_server/account.rs @@ -122,7 +122,7 @@ pub(crate) async fn register_route( }; if body.body.login_type == Some(LoginType::ApplicationService) { - if let Some(ref info) = body.appservice_info { + if let Some(info) = &body.appservice_info { if !info.is_user_match(&user_id) { return Err(Error::BadRequest( ErrorKind::Exclusive, diff --git a/src/api/client_server/alias.rs b/src/api/client_server/alias.rs index 6e198e26..45eff66c 100644 --- a/src/api/client_server/alias.rs +++ b/src/api/client_server/alias.rs @@ -25,7 +25,7 @@ pub(crate) async fn create_alias_route( )); } - if let Some(ref info) = body.appservice_info { + if let Some(info) = &body.appservice_info { if !info.aliases.is_match(body.room_alias.as_str()) { return Err(Error::BadRequest( ErrorKind::Exclusive, @@ -76,7 +76,7 @@ pub(crate) async fn delete_alias_route( )); } - if let Some(ref info) = body.appservice_info { + if let Some(info) = &body.appservice_info { if !info.aliases.is_match(body.room_alias.as_str()) { return Err(Error::BadRequest( ErrorKind::Exclusive, diff --git a/src/api/client_server/room.rs b/src/api/client_server/room.rs index f51696d1..f3edf62d 100644 --- a/src/api/client_server/room.rs +++ b/src/api/client_server/room.rs @@ -104,8 +104,8 @@ pub(crate) async fn create_room_route( } })?; - if let Some(ref alias) = alias { - if let Some(ref info) = body.appservice_info { + if let Some(alias) = &alias { + if let Some(info) = &body.appservice_info { if !info.aliases.is_match(alias.as_str()) { return Err(Error::BadRequest( ErrorKind::Exclusive, diff --git a/src/api/client_server/session.rs b/src/api/client_server/session.rs index d18d384a..0b2c2c42 100644 --- a/src/api/client_server/session.rs +++ b/src/api/client_server/session.rs @@ -147,7 +147,7 @@ pub(crate) async fn login_route(body: Ruma) -> Result) -> Result Result { let sender_user = body.sender_user.as_ref().expect("user is authenticated"); - if let Some(ref info) = body.appservice_info { + if let Some(info) = &body.appservice_info { if !info.is_user_match(sender_user) { return Err(Error::BadRequest( ErrorKind::Exclusive, diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 5bf8101b..6f46a232 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -93,7 +93,7 @@ impl FedDest { fn into_uri_string(self) -> String { match self { Self::Literal(addr) => addr.to_string(), - Self::Named(host, ref port) => host + port, + Self::Named(host, port) => format!("{host}{port}"), } }