Apply cargo-clippy fixes

This commit is contained in:
Natsu Kagami 2024-02-17 20:20:41 +01:00
parent 5bb6161b36
commit 508cf52e6f
Signed by: nki
GPG key ID: 55A032EB38B49ADB
5 changed files with 7 additions and 7 deletions

View file

@ -76,7 +76,7 @@ impl youmubot_prelude::Announcer for Announcer {
Ok(v) => {
osu_user.pp = v
.iter()
.map(|u| u.pp.clone())
.map(|u| u.pp)
.collect::<Vec<_>>()
.try_into()
.unwrap();

View file

@ -170,7 +170,7 @@ impl From<model::OsuUser> for OsuUser {
user_id: UserId(u.user_id as u64),
username: u
.username
.map(|v| Cow::Owned(v))
.map(Cow::Owned)
.unwrap_or("unknown".into()),
id: u.id as u64,
last_update: u.last_update,

View file

@ -199,7 +199,7 @@ pub async fn save(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
}
Ok(None)
}
let (score, mode) = match find_score(&osu, &u).await? {
let (score, mode) = match find_score(osu, &u).await? {
Some(v) => v,
None => {
msg.reply(
@ -245,7 +245,7 @@ pub async fn save(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
let reaction = reply.react(&ctx, '👌').await?;
let completed = loop {
let emoji = reaction.emoji.clone();
let user_reaction = CollectReaction::new(&ctx)
let user_reaction = CollectReaction::new(ctx)
.message_id(reply.id.0)
.author_id(msg.author.id.0)
.filter(move |r| r.emoji == emoji)
@ -253,7 +253,7 @@ pub async fn save(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
.collect_limit(1)
.await;
if let Some(ur) = user_reaction {
if check(&osu, &u, score.beatmap_id).await? {
if check(osu, &u, score.beatmap_id).await? {
break true;
}
if let ReactionAction::Added(ur) = &*ur {

View file

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use std::fmt;
const LAZER_TEXT: &'static str = "v2";
const LAZER_TEXT: &str = "v2";
bitflags::bitflags! {
/// The mods available to osu!

View file

@ -45,7 +45,7 @@ impl Beatmap {
beatmapset_id: set.mapset_id as u64,
creator: set.creator_name.clone().into_string(),
creator_id: set.creator_id as u64,
source: Some(set.source.clone()).filter(|s| s != "").clone(),
source: Some(set.source.clone()).filter(|s| !s.is_empty()).clone(),
genre: set.genre.map(|v| v.into()).unwrap_or(Genre::Unspecified),
language: set.language.map(|v| v.into()).unwrap_or(Language::Any),
tags: set.tags.split(", ").map(|v| v.to_owned()).collect(),