1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Fix clippy warnings from latest PR merge

This commit is contained in:
NG (Graham)
2026-02-22 22:46:23 -05:00
parent f0cca11d3c
commit 5d4123026d

View File

@@ -389,7 +389,7 @@ impl super::SocialUser for UserData {
format!("Failed to retrieve avatar info: {}", e), format!("Failed to retrieve avatar info: {}", e),
) )
})? })?
.map(|x| x.data.parse().ok()).flatten(); .and_then(|x| x.data.parse().ok());
if !avatar.is_empty() { if !avatar.is_empty() {
self.save_clan_avatar(avatar, &clan.name).await?; self.save_clan_avatar(avatar, &clan.name).await?;
@@ -545,7 +545,7 @@ impl super::SocialUser for UserData {
log::warn!("User {} tried to leave clan {} that they lead", self.account.id, joined_clan.id); log::warn!("User {} tried to leave clan {} that they lead", self.account.id, joined_clan.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::NotClanLeader as i16, crate::data::error_codes::SocialErrorCode::NotClanLeader as i16,
format!("Failed to leave clan: you are the leader"), "Failed to leave clan: you are the leader".to_string(),
)); ));
} }
let new_model = oj_rc_database::schema::clan_member::ActiveModel { let new_model = oj_rc_database::schema::clan_member::ActiveModel {
@@ -583,7 +583,7 @@ impl super::SocialUser for UserData {
log::warn!("User {} tried to remove user {} from clan {} without permission", self.account.id, public_id, joined_clan.id); log::warn!("User {} tried to remove user {} from clan {} without permission", self.account.id, public_id, joined_clan.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::ClanRankTooLow as i16, crate::data::error_codes::SocialErrorCode::ClanRankTooLow as i16,
format!("Failed to remove user from clan: no permission"), "Failed to remove user from clan: no permission".to_string(),
)); ));
} }
let members = self.db.clan_members_by_clan_id(joined_clan.id).await let members = self.db.clan_members_by_clan_id(joined_clan.id).await
@@ -606,7 +606,7 @@ impl super::SocialUser for UserData {
log::warn!("User {} tried to remove user {} from clan {} with insufficient permission", self.account.id, target_user.id, joined_clan.id); log::warn!("User {} tried to remove user {} from clan {} with insufficient permission", self.account.id, target_user.id, joined_clan.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::ClanRankTooLow as i16, crate::data::error_codes::SocialErrorCode::ClanRankTooLow as i16,
format!("Failed to remove user from clan: insufficient permission"), "Failed to remove user from clan: insufficient permission".to_string(),
)); ));
} }
let new_model = oj_rc_database::schema::clan_member::ActiveModel { let new_model = oj_rc_database::schema::clan_member::ActiveModel {
@@ -627,7 +627,7 @@ impl super::SocialUser for UserData {
log::warn!("User {} tried to remove non-existent user {} from clan {}", self.account.id, public_id, joined_clan.id); log::warn!("User {} tried to remove non-existent user {} from clan {}", self.account.id, public_id, joined_clan.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::UserNotFoundInClan as i16, crate::data::error_codes::SocialErrorCode::UserNotFoundInClan as i16,
format!("Failed to remove user from clan: user not in clan"), "Failed to remove user from clan: user not in clan".to_string(),
)); ));
} }
} else { } else {
@@ -651,7 +651,7 @@ impl super::SocialUser for UserData {
log::debug!("User {} is not leader but tried to modify clan {}", self.account.id, joined_clan.id); log::debug!("User {} is not leader but tried to modify clan {}", self.account.id, joined_clan.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::NotClanLeader as i16, crate::data::error_codes::SocialErrorCode::NotClanLeader as i16,
format!("Failed to modify clan: user is not the leader"), "Failed to modify clan: user is not the leader".to_string(),
)); ));
} }
let new_clan = oj_rc_database::schema::clan::ActiveModel { let new_clan = oj_rc_database::schema::clan::ActiveModel {
@@ -677,7 +677,7 @@ impl super::SocialUser for UserData {
log::debug!("User {} is not in a clan but tried to modify clan", self.account.id); log::debug!("User {} is not in a clan but tried to modify clan", self.account.id);
return Err(polariton_server::operations::SimpleOpError::with_message( return Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::UserNotInClan as i16, crate::data::error_codes::SocialErrorCode::UserNotInClan as i16,
format!("Failed to modify clan for user not in clan"), "Failed to modify clan for user not in clan".to_string(),
)); ));
} }
} }
@@ -775,7 +775,7 @@ impl super::SocialUser for UserData {
public_id: target_user.public_id, public_id: target_user.public_id,
display_name: target_user.display_name, display_name: target_user.display_name,
is_confirmed: false, is_confirmed: false,
avatar_id: avatar_id, avatar_id,
rank: super::ClanMemberRank::Member, rank: super::ClanMemberRank::Member,
season_xp: 0, season_xp: 0,
}) })
@@ -783,7 +783,7 @@ impl super::SocialUser for UserData {
log::debug!("User {} tried to invite user {} to their non-existent clan", self.account.id, public_id); log::debug!("User {} tried to invite user {} to their non-existent clan", self.account.id, public_id);
Err(polariton_server::operations::SimpleOpError::with_message( Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::UserNotInClan as i16, crate::data::error_codes::SocialErrorCode::UserNotInClan as i16,
format!("Failed to invite user to clan for user: invitee is not in clan"), "Failed to invite user to clan for user: invitee is not in clan".to_string(),
)) ))
} }
} }
@@ -868,7 +868,7 @@ impl super::SocialUser for UserData {
log::debug!("User {} cannot decline non-existent invite to clan {}", self.account.id, clan_name); log::debug!("User {} cannot decline non-existent invite to clan {}", self.account.id, clan_name);
Err(polariton_server::operations::SimpleOpError::with_message( Err(polariton_server::operations::SimpleOpError::with_message(
crate::data::error_codes::SocialErrorCode::NoInvite as i16, crate::data::error_codes::SocialErrorCode::NoInvite as i16,
format!("User cannot decline non-existent clan invite"), "User cannot decline non-existent clan invite".to_string(),
)) ))
} }
} }