Skip to content

Commit 7d82533

Browse files
Reformat
1 parent e0712a4 commit 7d82533

File tree

5 files changed

+22
-35
lines changed

5 files changed

+22
-35
lines changed

xpd-common/src/lib.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,7 @@ pub struct AuditLogEvent {
208208
pub kind: AuditLogEventKind,
209209
}
210210

211-
#[derive(
212-
Clone,
213-
Copy,
214-
Debug,
215-
PartialEq,
216-
Eq,
217-
serde::Serialize,
218-
serde::Deserialize,
219-
FromRepr,
220-
)]
211+
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize, FromRepr)]
221212
#[non_exhaustive]
222213
#[repr(i16)]
223214
pub enum AuditLogEventKind {

xpd-database/src/lib.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ use twilight_model::id::{
2323
marker::{ChannelMarker, GenericMarker, GuildMarker, RoleMarker, UserMarker},
2424
};
2525
use util::{db_to_id, id_to_db};
26-
use xpd_common::{AuditLogEvent, AuditLogEventKind, GuildConfig, RoleReward, UserInGuild, UserStatus};
26+
use xpd_common::{
27+
AuditLogEvent, AuditLogEventKind, GuildConfig, RoleReward, UserInGuild, UserStatus,
28+
};
2729
pub async fn guild_rewards<
2830
'a,
2931
D: DerefMut<Target = PgConnection> + Send,
@@ -253,12 +255,9 @@ pub async fn delete_audit_log_events_guild<
253255
guild: Id<GuildMarker>,
254256
) -> Result<(), Error> {
255257
let mut conn = conn.acquire().await?;
256-
query!(
257-
"DELETE FROM audit_logs WHERE guild = $1",
258-
id_to_db(guild)
259-
)
260-
.execute(conn.as_mut())
261-
.await?;
258+
query!("DELETE FROM audit_logs WHERE guild = $1", id_to_db(guild))
259+
.execute(conn.as_mut())
260+
.await?;
262261
Ok(())
263262
}
264263

@@ -271,12 +270,9 @@ pub async fn delete_audit_log_events_user<
271270
target: Id<UserMarker>,
272271
) -> Result<(), Error> {
273272
let mut conn = conn.acquire().await?;
274-
query!(
275-
"DELETE FROM audit_logs WHERE target = $1",
276-
id_to_db(target)
277-
)
278-
.execute(conn.as_mut())
279-
.await?;
273+
query!("DELETE FROM audit_logs WHERE target = $1", id_to_db(target))
274+
.execute(conn.as_mut())
275+
.await?;
280276
Ok(())
281277
}
282278

@@ -1098,7 +1094,7 @@ impl Display for Error {
10981094
Self::Database(de) => write!(f, "{de}"),
10991095
Self::Interpolation(ie) => write!(f, "{ie}"),
11001096
Self::UnspecifiedDelete => f.write_str("No constraints specified to delete by."),
1101-
Self::UnknownAuditLogEventKind => f.write_str("Unknown audit log event kind")
1097+
Self::UnknownAuditLogEventKind => f.write_str("Unknown audit log event kind"),
11021098
}
11031099
}
11041100
}

xpd-database/src/test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async fn audit_log_multi(db: PgPool) -> Result<(), Box<dyn std::error::Error>> {
6262
timestamp: 50,
6363
previous: 100,
6464
delta: -100,
65-
kind: AuditLogEventKind::Reset
65+
kind: AuditLogEventKind::Reset,
6666
},
6767
AuditLogEvent {
6868
guild: Id::new(1),
@@ -71,7 +71,7 @@ async fn audit_log_multi(db: PgPool) -> Result<(), Box<dyn std::error::Error>> {
7171
timestamp: 591,
7272
previous: 15,
7373
delta: 50,
74-
kind: AuditLogEventKind::Set
74+
kind: AuditLogEventKind::Set,
7575
},
7676
];
7777
for event in &original_events {
@@ -90,13 +90,13 @@ async fn audit_log_multi(db: PgPool) -> Result<(), Box<dyn std::error::Error>> {
9090
async fn audit_logs_deleted_guild(db: PgPool) -> Result<(), Box<dyn std::error::Error>> {
9191
let original_events = vec![
9292
AuditLogEvent {
93-
guild: Id::new(1),
94-
target: Id::new(2),
93+
guild: Id::new(1),
94+
target: Id::new(2),
9595
moderator: Id::new(3),
9696
timestamp: 50,
9797
previous: 100,
9898
delta: -100,
99-
kind: AuditLogEventKind::AddSub
99+
kind: AuditLogEventKind::AddSub,
100100
},
101101
AuditLogEvent {
102102
guild: Id::new(1),
@@ -105,7 +105,7 @@ async fn audit_logs_deleted_guild(db: PgPool) -> Result<(), Box<dyn std::error::
105105
timestamp: 591,
106106
previous: 15,
107107
delta: 50,
108-
kind: AuditLogEventKind::AddSub
108+
kind: AuditLogEventKind::AddSub,
109109
},
110110
AuditLogEvent {
111111
guild: Id::new(2),
@@ -114,7 +114,7 @@ async fn audit_logs_deleted_guild(db: PgPool) -> Result<(), Box<dyn std::error::
114114
timestamp: 595,
115115
previous: 100,
116116
delta: 50,
117-
kind: AuditLogEventKind::Set
117+
kind: AuditLogEventKind::Set,
118118
},
119119
];
120120
for event in &original_events {

xpd-listener/src/audit_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async fn take_audit_log_action(
7979
timestamp: xpd_util::snowflake_to_timestamp(id),
8080
previous: old_xp,
8181
delta: -old_xp,
82-
kind
82+
kind,
8383
};
8484

8585
xpd_database::add_audit_log_event(txn.as_mut(), audit_log_event).await?;

xpd-slash/src/experience.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async fn modify_user_xp(
7878
timestamp: snowflake_to_timestamp(audit.interaction),
7979
previous: xp + amount,
8080
delta: amount,
81-
kind: AuditLogEventKind::AddSub
81+
kind: AuditLogEventKind::AddSub,
8282
};
8383
xpd_database::add_audit_log_event(txn.as_mut(), audit_event).await?;
8484

@@ -111,7 +111,7 @@ async fn reset_user_xp(
111111
timestamp: snowflake_to_timestamp(audit.interaction),
112112
previous: old_xp,
113113
delta: -old_xp,
114-
kind: AuditLogEventKind::Reset
114+
kind: AuditLogEventKind::Reset,
115115
};
116116
xpd_database::add_audit_log_event(txn.as_mut(), audit_event).await?;
117117

@@ -142,7 +142,7 @@ async fn set_user_xp(
142142
timestamp: snowflake_to_timestamp(audit.interaction),
143143
previous: old_xp,
144144
delta: setpoint - old_xp,
145-
kind: AuditLogEventKind::Set
145+
kind: AuditLogEventKind::Set,
146146
};
147147
xpd_database::add_audit_log_event(txn.as_mut(), audit_event).await?;
148148

0 commit comments

Comments
 (0)