style(clippy): use variables in the format string directly

This commit is contained in:
Ax333l 2023-02-03 19:29:47 +01:00
parent b2fda777e4
commit 9b7b2d49d5
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23
4 changed files with 11 additions and 12 deletions

View File

@ -42,7 +42,7 @@ pub async fn reply(
channel.say(http, &message).await?; channel.say(http, &message).await?;
} }
send_ephermal(&ctx, &format!("Response: {}", message)).await?; send_ephermal(&ctx, &format!("Response: {message}")).await?;
Ok(()) Ok(())
} }
@ -82,7 +82,7 @@ pub async fn poll(
r.create_button(|b| { r.create_button(|b| {
b.label("Vote") b.label("Vote")
.emoji(ReactionType::Unicode("🗳️".to_string())) .emoji(ReactionType::Unicode("🗳️".to_string()))
.custom_id(format!("poll:{}:{}", id, age)) .custom_id(format!("poll:{id}:{age}"))
}) })
}) })
}) })

View File

@ -318,7 +318,7 @@ pub async fn mute(
} }
.await; .await;
let duration = unmute_time.map(|time| format!("<t:{}:F>", time)); let duration = unmute_time.map(|time| format!("<t:{time}:F>"));
respond_moderation( respond_moderation(
&ctx, &ctx,

View File

@ -69,8 +69,7 @@ impl CodeUrlParser for GitHubCodeUrl {
} }
let raw_url = format!( let raw_url = format!(
"https://raw.githubusercontent.com/{}/{}/{}{}", "https://raw.githubusercontent.com/{user}/{repo}/{branch_or_sha}{path}"
user, repo, branch_or_sha, path
); );
let mut code_url = CodeUrl { let mut code_url = CodeUrl {
@ -133,7 +132,7 @@ impl CodeUrlParser for GitHubCodeUrl {
let end = end - 1; let end = end - 1;
if start > end || start >= lines.len() || end >= lines.len() { if start > end || start >= lines.len() || end >= lines.len() {
return Err(ParserError::InvalidFragment(format!("{}-{}", start, end))); return Err(ParserError::InvalidFragment(format!("{start}-{end}")));
} }
let mut code_block = String::new(); let mut code_block = String::new();
@ -177,19 +176,19 @@ impl fmt::Display for ParserError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
ParserError::Error(e) => { ParserError::Error(e) => {
write!(f, "Error: {}", e) write!(f, "Error: {e}")
}, },
ParserError::WrongParserError(expected, got) => { ParserError::WrongParserError(expected, got) => {
write!(f, "Expected parser {}, got {}", expected, got) write!(f, "Expected parser {expected}, got {got}")
}, },
ParserError::ConversionError(conversion_error) => { ParserError::ConversionError(conversion_error) => {
write!(f, "Conversion error: {}", conversion_error) write!(f, "Conversion error: {conversion_error}")
}, },
ParserError::InvalidFragment(fragment) => { ParserError::InvalidFragment(fragment) => {
write!(f, "Invalid fragment: {}", fragment) write!(f, "Invalid fragment: {fragment}")
}, },
ParserError::FailedToGetCode(error) => { ParserError::FailedToGetCode(error) => {
write!(f, "Failed to get code: {}", error) write!(f, "Failed to get code: {error}")
}, },
} }
} }

View File

@ -48,7 +48,7 @@ pub async fn handle_poll(
.create_interaction_response(&ctx.http, |r| { .create_interaction_response(&ctx.http, |r| {
r.interaction_response_data(|m| { r.interaction_response_data(|m| {
if let Ok(token) = result.as_deref() { if let Ok(token) = result.as_deref() {
let url = format!("https://revanced.app/poll#{}", token); let url = format!("https://revanced.app/poll#{token}");
m.components(|c| { m.components(|c| {
c.create_action_row(|r| { c.create_action_row(|r| {
r.create_button(|b| { r.create_button(|b| {