mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
satisfy clippy
This commit is contained in:
parent
4b508966a2
commit
729484af4c
9 changed files with 19 additions and 15 deletions
|
@ -1333,6 +1333,8 @@ macro_rules! requester_forward {
|
|||
}
|
||||
|
||||
#[test]
|
||||
// waffle: efficiency is not important here, and I don't want to rewrite this
|
||||
#[allow(clippy::format_collect)]
|
||||
fn codegen_requester_forward() {
|
||||
use crate::codegen::{
|
||||
add_hidden_preamble,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// waffle: efficiency is not important here, and I don't want to rewrite this
|
||||
#![allow(clippy::format_collect)]
|
||||
|
||||
use std::{borrow::Borrow, collections::HashSet, ops::Deref};
|
||||
|
||||
use itertools::Itertools;
|
||||
|
@ -51,7 +54,7 @@ fn codegen_payloads() {
|
|||
|
||||
let multipart = multipart_input_file_fields(&method)
|
||||
.map(|field| format!(" @[multipart = {}]\n", field.join(", ")))
|
||||
.unwrap_or_else(String::new);
|
||||
.unwrap_or_default();
|
||||
|
||||
let derive = if !multipart.is_empty()
|
||||
|| matches!(
|
||||
|
|
|
@ -1337,6 +1337,8 @@ where
|
|||
// }
|
||||
|
||||
#[test]
|
||||
// waffle: efficiency is not important here, and I don't want to rewrite this
|
||||
#[allow(clippy::format_collect)]
|
||||
fn codegen_requester_methods() {
|
||||
use crate::codegen::{
|
||||
add_hidden_preamble,
|
||||
|
|
|
@ -315,7 +315,7 @@ pub(crate) mod serde_opt_date_from_unix_timestamp {
|
|||
}
|
||||
|
||||
{
|
||||
let json = r#"{}"#;
|
||||
let json = "{}";
|
||||
|
||||
let Struct { date } = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(date, None);
|
||||
|
|
|
@ -203,8 +203,8 @@ impl PassportElementErrorReverseSide {
|
|||
}
|
||||
}
|
||||
|
||||
//// Represents an issue with the selfie with a document.
|
||||
//
|
||||
/// Represents an issue with the selfie with a document.
|
||||
///
|
||||
/// The error is considered resolved when the file with the selfie changes.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorselfie).
|
||||
|
|
|
@ -31,7 +31,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn chat_id_id_serialization() {
|
||||
let expected_json = String::from(r#"123456"#);
|
||||
let expected_json = String::from("123456");
|
||||
let actual_json = serde_json::to_string(&Recipient::Id(ChatId(123_456))).unwrap();
|
||||
|
||||
assert_eq!(expected_json, actual_json)
|
||||
|
|
|
@ -66,7 +66,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn smoke_deser() {
|
||||
let json = r#"123"#;
|
||||
let json = "123";
|
||||
let mid: ThreadId = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(mid, ThreadId(MessageId(123)));
|
||||
}
|
||||
|
@ -75,6 +75,6 @@ mod tests {
|
|||
fn smoke_ser() {
|
||||
let mid: ThreadId = ThreadId(MessageId(123));
|
||||
let json = serde_json::to_string(&mid).unwrap();
|
||||
assert_eq!(json, r#"123"#);
|
||||
assert_eq!(json, "123");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ impl<S> SqliteStorage<S> {
|
|||
let pool = SqlitePool::connect(format!("sqlite:{path}?mode=rwc").as_str()).await?;
|
||||
let mut conn = pool.acquire().await?;
|
||||
sqlx::query(
|
||||
r#"
|
||||
"
|
||||
CREATE TABLE IF NOT EXISTS teloxide_dialogues (
|
||||
chat_id BIGINT PRIMARY KEY,
|
||||
dialogue BLOB NOT NULL
|
||||
);
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.execute(&mut conn)
|
||||
.await?;
|
||||
|
@ -98,10 +98,10 @@ where
|
|||
.await?
|
||||
.execute(
|
||||
sqlx::query(
|
||||
r#"
|
||||
"
|
||||
INSERT INTO teloxide_dialogues VALUES (?, ?)
|
||||
ON CONFLICT(chat_id) DO UPDATE SET dialogue=excluded.dialogue
|
||||
"#,
|
||||
",
|
||||
)
|
||||
.bind(chat_id)
|
||||
.bind(d),
|
||||
|
|
|
@ -283,9 +283,6 @@ mod tests {
|
|||
is_premium: false,
|
||||
added_to_attachment_menu: false,
|
||||
};
|
||||
assert_eq!(
|
||||
user_mention_or_link(&user_without_username),
|
||||
r#"[Name](tg://user/?id=123456789)"#
|
||||
)
|
||||
assert_eq!(user_mention_or_link(&user_without_username), "[Name](tg://user/?id=123456789)")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue