mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
enable ref_patterns lint
This commit is contained in:
parent
6bdaeab1af
commit
d144db8688
6 changed files with 10 additions and 9 deletions
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue