enable ref_patterns lint

This commit is contained in:
Charles Hall 2024-05-12 18:38:12 -07:00
parent 6bdaeab1af
commit d144db8688
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
6 changed files with 10 additions and 9 deletions

View file

@ -45,6 +45,7 @@ rc_buffer = "warn"
rc_mutex = "warn" rc_mutex = "warn"
redundant_feature_names = "warn" redundant_feature_names = "warn"
redundant_type_annotations = "warn" redundant_type_annotations = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn" rest_pat_in_fully_bound_structs = "warn"
semicolon_inside_block = "warn" semicolon_inside_block = "warn"
str_to_string = "warn" str_to_string = "warn"

View file

@ -122,7 +122,7 @@ pub(crate) async fn register_route(
}; };
if body.body.login_type == Some(LoginType::ApplicationService) { 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) { if !info.is_user_match(&user_id) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,

View file

@ -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()) { if !info.aliases.is_match(body.room_alias.as_str()) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, 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()) { if !info.aliases.is_match(body.room_alias.as_str()) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,

View file

@ -104,8 +104,8 @@ pub(crate) async fn create_room_route(
} }
})?; })?;
if let Some(ref alias) = alias { if let Some(alias) = &alias {
if let Some(ref info) = body.appservice_info { if let Some(info) = &body.appservice_info {
if !info.aliases.is_match(alias.as_str()) { if !info.aliases.is_match(alias.as_str()) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,

View file

@ -147,7 +147,7 @@ pub(crate) async fn login_route(body: Ruma<login::v3::Request>) -> Result<login:
} }
.map_err(|_| Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid."))?; .map_err(|_| Error::BadRequest(ErrorKind::InvalidUsername, "Username is invalid."))?;
if let Some(ref info) = body.appservice_info { if let Some(info) = &body.appservice_info {
if !info.is_user_match(&user_id) { if !info.is_user_match(&user_id) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,
@ -227,7 +227,7 @@ pub(crate) async fn logout_route(body: Ruma<logout::v3::Request>) -> Result<logo
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let sender_device = body.sender_device.as_ref().expect("user is authenticated"); let sender_device = body.sender_device.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) { if !info.is_user_match(sender_user) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,
@ -257,7 +257,7 @@ pub(crate) async fn logout_all_route(
) -> Result<logout_all::v3::Response> { ) -> Result<logout_all::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); 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) { if !info.is_user_match(sender_user) {
return Err(Error::BadRequest( return Err(Error::BadRequest(
ErrorKind::Exclusive, ErrorKind::Exclusive,

View file

@ -93,7 +93,7 @@ impl FedDest {
fn into_uri_string(self) -> String { fn into_uri_string(self) -> String {
match self { match self {
Self::Literal(addr) => addr.to_string(), Self::Literal(addr) => addr.to_string(),
Self::Named(host, ref port) => host + port, Self::Named(host, port) => format!("{host}{port}"),
} }
} }