chore: remove clippy warnings (#213)

This commit is contained in:
ToastXC
2023-01-19 02:16:27 +08:00
committed by GitHub
parent 32d3683013
commit fc32996b51
4 changed files with 5 additions and 9 deletions

View File

@@ -23,11 +23,7 @@ impl Cache {
pub async fn can_view_channel(&self, db: &Database, channel: &Channel) -> bool {
match &channel {
Channel::TextChannel { server, .. } | Channel::VoiceChannel { server, .. } => {
let member = self
.members
.iter()
.map(|(_, x)| x)
.find(|x| &x.id.server == server);
let member = self.members.values().find(|x| &x.id.server == server);
let server = self.servers.get(server);
let mut perms = perms(self.users.get(&self.user_id).unwrap()).channel(channel);

View File

@@ -97,7 +97,7 @@ impl From<i64> for PermissionValue {
impl From<u64> for PermissionValue {
fn from(v: u64) -> Self {
Self(v as u64)
Self(v)
}
}

View File

@@ -35,7 +35,7 @@ pub async fn presence_create_session(user_id: &str, flags: u8) -> (bool, u8) {
__set_key_presence_entry(&mut conn, user_id, entry).await;
// Add to region set in case of failure.
__add_to_set_sessions(&mut conn, &*REGION_KEY, user_id, session_id).await;
__add_to_set_sessions(&mut conn, &REGION_KEY, user_id, session_id).await;
(was_empty, session_id)
}
@@ -74,7 +74,7 @@ async fn presence_delete_session_internal(
// Remove from region set.
if !skip_region {
__remove_from_set_sessions(&mut conn, &*REGION_KEY, user_id, session_id).await;
__remove_from_set_sessions(&mut conn, &REGION_KEY, user_id, session_id).await;
}
}

View File

@@ -38,7 +38,7 @@ pub async fn queue(channel: String, id: String, content: String) {
pub async fn worker(db: Database) {
loop {
let task = Q.pop().await;
if let Ok(embeds) = Embed::generate(task.content, &*JANUARY_URL, *MAX_EMBED_COUNT).await {
if let Ok(embeds) = Embed::generate(task.content, &JANUARY_URL, *MAX_EMBED_COUNT).await {
if let Err(err) = Message::append(
&db,
task.id,