refactor: solve clippy hints

This commit is contained in:
Paul Makles
2023-08-27 11:23:02 +01:00
parent 5372296dc0
commit c2412190a8
5 changed files with 15 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ impl AbstractChannelUnreads for ReferenceDb {
async fn acknowledge_channels(&self, user_id: &str, channel_ids: &[String]) -> Result<()> {
let current_time = Ulid::new().to_string();
for channel_id in channel_ids {
#[allow(clippy::disallowed_methods)]
self.acknowledge_message(channel_id, user_id, &current_time)
.await?;
}

View File

@@ -164,6 +164,7 @@ auto_derived!(
}
);
#[allow(clippy::disallowed_methods)]
impl Channel {
/// Create a channel
pub async fn create(&self, db: &Database) -> Result<()> {

View File

@@ -128,6 +128,7 @@ auto_derived!(
}
);
#[allow(clippy::disallowed_methods)]
impl Server {
/// Create a server
pub async fn create(&self, db: &Database) -> Result<()> {

View File

@@ -394,9 +394,7 @@ impl From<crate::Interactions> for Interactions {
impl From<crate::AppendMessage> for AppendMessage {
fn from(value: crate::AppendMessage) -> Self {
AppendMessage {
embeds: value
.embeds
.map(|embeds| embeds.into_iter().map(|embed| embed.into()).collect()),
embeds: value.embeds,
}
}
}

View File

@@ -243,6 +243,8 @@ impl User {
return Err(Error::DiscriminatorChangeRatelimited);
}
// FIXME: don't access directly?
#[allow(clippy::disallowed_methods)]
rvdb.insert_ratelimit_event(&revolt_database::RatelimitEvent {
id: ulid::Ulid::new().to_string(),
target_id,
@@ -471,8 +473,15 @@ impl User {
match hint {
UserHint::Bot => {
let rvdb: revolt_database::Database = db.clone().into();
db.fetch_user(&rvdb.fetch_bot_by_token(token).await.map_err(|_| Error::InternalError)?.id).await
},
db.fetch_user(
&rvdb
.fetch_bot_by_token(token)
.await
.map_err(|_| Error::InternalError)?
.id,
)
.await
}
UserHint::User => db.fetch_user_by_token(token).await,
UserHint::Any => {
if let Ok(user) = User::from_token(db, token, UserHint::User).await {