mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-23 07:09:34 +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]
|
#[test]
|
||||||
|
// waffle: efficiency is not important here, and I don't want to rewrite this
|
||||||
|
#[allow(clippy::format_collect)]
|
||||||
fn codegen_requester_forward() {
|
fn codegen_requester_forward() {
|
||||||
use crate::codegen::{
|
use crate::codegen::{
|
||||||
add_hidden_preamble,
|
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 std::{borrow::Borrow, collections::HashSet, ops::Deref};
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
@ -51,7 +54,7 @@ fn codegen_payloads() {
|
||||||
|
|
||||||
let multipart = multipart_input_file_fields(&method)
|
let multipart = multipart_input_file_fields(&method)
|
||||||
.map(|field| format!(" @[multipart = {}]\n", field.join(", ")))
|
.map(|field| format!(" @[multipart = {}]\n", field.join(", ")))
|
||||||
.unwrap_or_else(String::new);
|
.unwrap_or_default();
|
||||||
|
|
||||||
let derive = if !multipart.is_empty()
|
let derive = if !multipart.is_empty()
|
||||||
|| matches!(
|
|| matches!(
|
||||||
|
|
|
@ -1337,6 +1337,8 @@ where
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
// waffle: efficiency is not important here, and I don't want to rewrite this
|
||||||
|
#[allow(clippy::format_collect)]
|
||||||
fn codegen_requester_methods() {
|
fn codegen_requester_methods() {
|
||||||
use crate::codegen::{
|
use crate::codegen::{
|
||||||
add_hidden_preamble,
|
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();
|
let Struct { date } = serde_json::from_str(json).unwrap();
|
||||||
assert_eq!(date, None);
|
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 error is considered resolved when the file with the selfie changes.
|
||||||
///
|
///
|
||||||
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorselfie).
|
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorselfie).
|
||||||
|
|
|
@ -31,7 +31,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn chat_id_id_serialization() {
|
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();
|
let actual_json = serde_json::to_string(&Recipient::Id(ChatId(123_456))).unwrap();
|
||||||
|
|
||||||
assert_eq!(expected_json, actual_json)
|
assert_eq!(expected_json, actual_json)
|
||||||
|
|
|
@ -66,7 +66,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn smoke_deser() {
|
fn smoke_deser() {
|
||||||
let json = r#"123"#;
|
let json = "123";
|
||||||
let mid: ThreadId = serde_json::from_str(json).unwrap();
|
let mid: ThreadId = serde_json::from_str(json).unwrap();
|
||||||
assert_eq!(mid, ThreadId(MessageId(123)));
|
assert_eq!(mid, ThreadId(MessageId(123)));
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,6 @@ mod tests {
|
||||||
fn smoke_ser() {
|
fn smoke_ser() {
|
||||||
let mid: ThreadId = ThreadId(MessageId(123));
|
let mid: ThreadId = ThreadId(MessageId(123));
|
||||||
let json = serde_json::to_string(&mid).unwrap();
|
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 pool = SqlitePool::connect(format!("sqlite:{path}?mode=rwc").as_str()).await?;
|
||||||
let mut conn = pool.acquire().await?;
|
let mut conn = pool.acquire().await?;
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
r#"
|
"
|
||||||
CREATE TABLE IF NOT EXISTS teloxide_dialogues (
|
CREATE TABLE IF NOT EXISTS teloxide_dialogues (
|
||||||
chat_id BIGINT PRIMARY KEY,
|
chat_id BIGINT PRIMARY KEY,
|
||||||
dialogue BLOB NOT NULL
|
dialogue BLOB NOT NULL
|
||||||
);
|
);
|
||||||
"#,
|
",
|
||||||
)
|
)
|
||||||
.execute(&mut conn)
|
.execute(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -98,10 +98,10 @@ where
|
||||||
.await?
|
.await?
|
||||||
.execute(
|
.execute(
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
r#"
|
"
|
||||||
INSERT INTO teloxide_dialogues VALUES (?, ?)
|
INSERT INTO teloxide_dialogues VALUES (?, ?)
|
||||||
ON CONFLICT(chat_id) DO UPDATE SET dialogue=excluded.dialogue
|
ON CONFLICT(chat_id) DO UPDATE SET dialogue=excluded.dialogue
|
||||||
"#,
|
",
|
||||||
)
|
)
|
||||||
.bind(chat_id)
|
.bind(chat_id)
|
||||||
.bind(d),
|
.bind(d),
|
||||||
|
|
|
@ -283,9 +283,6 @@ mod tests {
|
||||||
is_premium: false,
|
is_premium: false,
|
||||||
added_to_attachment_menu: false,
|
added_to_attachment_menu: false,
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(user_mention_or_link(&user_without_username), "[Name](tg://user/?id=123456789)")
|
||||||
user_mention_or_link(&user_without_username),
|
|
||||||
r#"[Name](tg://user/?id=123456789)"#
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue