chore: make improvements suggested by clippy
This commit is contained in:
@@ -142,7 +142,7 @@ pub async fn handle(state: State, interaction: Interaction) {
|
|||||||
.update_response(
|
.update_response(
|
||||||
&interaction.token,
|
&interaction.token,
|
||||||
).embeds(Some(&[
|
).embeds(Some(&[
|
||||||
EmbedBuilder::new().title("Joined VC with intent to record").description(&format!("This bot joined {channel_mention} and intends to start recording after a responsible disclosure and consent.")).validate().unwrap().build()
|
EmbedBuilder::new().title("Joined VC with intent to record").description(format!("This bot joined {channel_mention} and intends to start recording after a responsible disclosure and consent.")).validate().unwrap().build()
|
||||||
]))
|
]))
|
||||||
.await
|
.await
|
||||||
.expect("TODO");
|
.expect("TODO");
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub struct Router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Router {
|
impl Router {
|
||||||
fn add_route<'s, 'a, Fut, Handler>(&'s mut self, name: &'a str, handler: Handler)
|
fn add_route<Fut, Handler>(&mut self, name: &str, handler: Handler)
|
||||||
where
|
where
|
||||||
Fut: Future<Output = Return> + Send + 'static,
|
Fut: Future<Output = Return> + Send + 'static,
|
||||||
Handler: Fn(State, Interaction) -> Fut + 'static,
|
Handler: Fn(State, Interaction) -> Fut + 'static,
|
||||||
@@ -55,7 +55,7 @@ impl Router {
|
|||||||
self.add_route_already_boxed(name, box_handler(handler));
|
self.add_route_already_boxed(name, box_handler(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_route_already_boxed<'s, 'a>(&'s mut self, name: &'a str, boxed_handler: BoxedHandler) {
|
fn add_route_already_boxed(&mut self, name: &str, boxed_handler: BoxedHandler) {
|
||||||
self.map.insert(name, boxed_handler);
|
self.map.insert(name, boxed_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ where
|
|||||||
pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeMap<Right, RightData>)> {
|
pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeMap<Right, RightData>)> {
|
||||||
let (left, rights) = self.left_to_rights.remove_entry(left)?;
|
let (left, rights) = self.left_to_rights.remove_entry(left)?;
|
||||||
|
|
||||||
for (right, _right_data) in &rights {
|
for right in rights.keys() {
|
||||||
self.right_to_left.remove(right);
|
self.right_to_left.remove(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
type VCsInGuild = OneToManyUniqueBTreeMapWithData<Id<ChannelMarker>, Id<UserMarker>, UserInVCData>;
|
|
||||||
|
|
||||||
pub type VCs = DashMap<Id<GuildMarker>, VCsInGuild>;
|
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use futures::{
|
use futures::{StreamExt, stream::FuturesUnordered};
|
||||||
StreamExt,
|
|
||||||
stream::{self, FuturesUnordered},
|
|
||||||
};
|
|
||||||
use twilight_model::{
|
use twilight_model::{
|
||||||
gateway::payload::incoming::VoiceStateUpdate,
|
gateway::payload::incoming::VoiceStateUpdate,
|
||||||
id::{
|
id::{
|
||||||
@@ -19,6 +10,10 @@ use twilight_model::{
|
|||||||
|
|
||||||
use crate::{OneToManyUniqueBTreeMapWithData, UserInVCData, VoiceStatus};
|
use crate::{OneToManyUniqueBTreeMapWithData, UserInVCData, VoiceStatus};
|
||||||
|
|
||||||
|
type VCsInGuild = OneToManyUniqueBTreeMapWithData<Id<ChannelMarker>, Id<UserMarker>, UserInVCData>;
|
||||||
|
|
||||||
|
pub type VCs = DashMap<Id<GuildMarker>, VCsInGuild>;
|
||||||
|
|
||||||
#[tracing::instrument(skip(discord_client), ret)]
|
#[tracing::instrument(skip(discord_client), ret)]
|
||||||
async fn initialize_user_in_vc(
|
async fn initialize_user_in_vc(
|
||||||
discord_client: &twilight_http::Client,
|
discord_client: &twilight_http::Client,
|
||||||
|
|||||||
Reference in New Issue
Block a user