mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
refactor: solve clippy hints
This commit is contained in:
@@ -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, ¤t_time)
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ auto_derived!(
|
||||
}
|
||||
);
|
||||
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
impl Channel {
|
||||
/// Create a channel
|
||||
pub async fn create(&self, db: &Database) -> Result<()> {
|
||||
|
||||
@@ -128,6 +128,7 @@ auto_derived!(
|
||||
}
|
||||
);
|
||||
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
impl Server {
|
||||
/// Create a server
|
||||
pub async fn create(&self, db: &Database) -> Result<()> {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user