Merge pull request #1029 from teloxide/dependabot/cargo/lock-48f0f163d7

Bump the lock group with 33 updates
This commit is contained in:
Waffle Maybe 2024-03-21 15:06:20 +00:00 committed by GitHub
commit 4c131db181
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 118 additions and 192 deletions

View file

@ -19,7 +19,8 @@ env:
# When updating this, also update:
# - crates/teloxide-core/src/codegen.rs
# - rust-toolchain.toml
rust_nightly: nightly-2023-09-27
# - below in the test matrix
rust_nightly: nightly-2024-03-20
# When updating this, also update:
# - **/README.md
# - **/src/lib.rs
@ -90,7 +91,7 @@ jobs:
toolchain: beta
features: "--features full"
- rust: nightly
toolchain: nightly-2023-09-27
toolchain: nightly-2024-03-20
features: "--features full nightly"
- rust: msrv
toolchain: 1.68.0
@ -118,10 +119,14 @@ jobs:
# MSRV CI specifically instead. This allows as to
# 1. Not update MSRV unless we really need to
# 2. Test newest (or at least newer) versions of crates in CI
#
# Example command: `cargo update -p atomic-write-file@0.1.3 --precise 0.1.2`
- name: Downgrade deps for MSRV
if: ${{ matrix.rust == 'msrv' }}
run: |
cargo update -p atomic-write-file@0.1.3 --precise 0.1.2
cargo update -p sqlx --precise 0.7.3
cargo update -p atomic-write-file --precise 0.1.2
exit 0
# NB. Don't test (build) examples so we can use non-msrv features in them (--tests/--doc)

144
Cargo.lock generated
View file

@ -85,9 +85,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.77"
version = "0.1.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85"
dependencies = [
"proc-macro2",
"quote",
@ -103,16 +103,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "atomic-write-file"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8204db279bf648d64fe845bd8840f78b39c8132ed4d6a4194c3b10d4b4cfb0b"
dependencies = [
"nix",
"rand",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -238,9 +228,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.15.3"
version = "3.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b"
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
[[package]]
name = "byteorder"
@ -256,9 +246,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]]
name = "cc"
version = "1.0.88"
version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc"
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
[[package]]
name = "cfg-if"
@ -266,17 +256,11 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "chrono"
version = "0.4.34"
version = "0.4.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
dependencies = [
"android-tzdata",
"iana-time-zone",
@ -705,9 +689,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "h2"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb"
dependencies = [
"bytes",
"fnv",
@ -785,9 +769,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
version = "0.2.11"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
dependencies = [
"bytes",
"fnv",
@ -855,7 +839,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"socket2 0.5.6",
"socket2 0.4.10",
"tokio",
"tower-service",
"tracing",
@ -1017,9 +1001,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
version = "0.3.68"
version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
dependencies = [
"wasm-bindgen",
]
@ -1141,18 +1125,6 @@ dependencies = [
"tempfile",
]
[[package]]
name = "nix"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags 2.4.2",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "nom"
version = "7.1.3"
@ -1278,18 +1250,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.4"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.4"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
@ -1366,9 +1338,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.78"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
@ -1471,9 +1443,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick 1.1.2",
"memchr",
@ -1488,9 +1460,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "reqwest"
version = "0.11.24"
version = "0.11.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251"
checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2"
dependencies = [
"base64 0.21.7",
"bytes",
@ -1727,9 +1699,9 @@ dependencies = [
[[package]]
name = "serde_path_to_error"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c"
checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6"
dependencies = [
"itoa",
"serde",
@ -1842,9 +1814,9 @@ dependencies = [
[[package]]
name = "sqlx"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf"
checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa"
dependencies = [
"sqlx-core",
"sqlx-macros",
@ -1853,9 +1825,9 @@ dependencies = [
[[package]]
name = "sqlx-core"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd"
checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6"
dependencies = [
"ahash",
"atoi",
@ -1863,7 +1835,6 @@ dependencies = [
"bytes",
"crc",
"crossbeam-queue",
"dotenvy",
"either",
"event-listener",
"futures-channel",
@ -1896,9 +1867,9 @@ dependencies = [
[[package]]
name = "sqlx-macros"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5"
checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127"
dependencies = [
"proc-macro2",
"quote",
@ -1909,11 +1880,10 @@ dependencies = [
[[package]]
name = "sqlx-macros-core"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841"
checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8"
dependencies = [
"atomic-write-file",
"dotenvy",
"either",
"heck",
@ -1934,9 +1904,9 @@ dependencies = [
[[package]]
name = "sqlx-sqlite"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490"
checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa"
dependencies = [
"atoi",
"flume",
@ -2127,18 +2097,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.57"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.57"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
@ -2211,9 +2181,9 @@ dependencies = [
[[package]]
name = "tokio-stream"
version = "0.1.14"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
dependencies = [
"futures-core",
"pin-project-lite",
@ -2435,9 +2405,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.91"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -2445,9 +2415,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.91"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
dependencies = [
"bumpalo",
"log",
@ -2460,9 +2430,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.41"
version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
dependencies = [
"cfg-if",
"js-sys",
@ -2472,9 +2442,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.91"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -2482,9 +2452,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.91"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
@ -2495,9 +2465,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.91"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
[[package]]
name = "wasm-streams"
@ -2514,9 +2484,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.68"
version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
dependencies = [
"js-sys",
"wasm-bindgen",

View file

@ -12,7 +12,7 @@ use url::Url;
use crate::{
payloads::GetMe,
requests::{HasPayload, Request, Requester},
types::{Me, Recipient, *},
types::*,
};
/// `get_me` cache.

View file

@ -11,7 +11,7 @@ use crate::{
},
prelude::Requester,
requests::{HasPayload, Output, Request},
types::{InputFile, ParseMode, Recipient, *},
types::*,
};
/// Default parse mode adaptor, see

View file

@ -23,7 +23,7 @@ use xshell::{cmd, Shell};
fn ensure_rustfmt(sh: &Shell) {
// FIXME(waffle): find a better way to set toolchain
let toolchain = "nightly-2023-09-27";
let toolchain = "nightly-2024-03-20";
let version = cmd!(sh, "rustup run {toolchain} rustfmt --version").read().unwrap_or_default();
@ -36,7 +36,7 @@ fn ensure_rustfmt(sh: &Shell) {
}
pub fn reformat(text: String) -> String {
let toolchain = "nightly-2023-09-27";
let toolchain = "nightly-2024-03-20";
let sh = Shell::new().unwrap();
ensure_rustfmt(&sh);

View file

@ -61,7 +61,7 @@
html_logo_url = "https://cdn.discordapp.com/attachments/224881373326999553/798598120760934410/logo.png",
html_favicon_url = "https://cdn.discordapp.com/attachments/224881373326999553/798598120760934410/logo.png"
)]
#![forbid(unsafe_code)]
//
// we pass "--cfg docsrs" when building docs to add `This is supported on feature="..." only.`
//
// To properly build docs of this crate run
@ -78,16 +78,29 @@
)]
#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))]
#![cfg_attr(all(feature = "full", docsrs), deny(rustdoc::broken_intra_doc_links))]
//
// Lint levels
#![forbid(unsafe_code)]
//#![deny(missing_docs)]
#![warn(clippy::print_stdout, clippy::dbg_macro)]
#![allow(clippy::let_and_return)]
#![allow(clippy::bool_assert_comparison)]
// Unless this becomes machine applicable, I'm not adding 334 #[must_use]s (waffle)
#![allow(clippy::return_self_not_must_use)]
// Workaround for CI
#![allow(rustdoc::bare_urls)]
// FIXME: deal with these lints
#![allow(
// Sometimes it's more readable to assign to a variable and return it immediately
clippy::let_and_return,
// When you are testing ->bool functions, it makes sense to `assert_eq!(f(..), false)`
clippy::bool_assert_comparison,
// Unless this becomes machine applicable, I'm not adding 334 #[must_use]s (waffle)
clippy::return_self_not_must_use,
// This is dumb. `T: ?Sized where T: Trait` IMO makes perfect sense
clippy::multiple_bound_locations,
// Workaround for CI
// FIXME: do we still need this?
rustdoc::bare_urls,
// FIXME: deal with these lints
clippy::collapsible_str_replace,
clippy::borrow_deref_ref,
clippy::unnecessary_lazy_evaluations,

View file

@ -49,7 +49,7 @@ impl<R> From<TelegramResponse<R>> for ResponseResult<R> {
#[cfg(test)]
mod tests {
use super::*;
use crate::{errors::ApiError, types::Update};
use crate::types::Update;
#[test]
fn parse_terminated_by_other_get_updates() {

View file

@ -20,4 +20,3 @@ mod payload;
mod request;
mod requester;
mod requester_ext;
mod utils;

View file

@ -3,11 +3,7 @@
use url::Url;
use crate::{
payloads::{GetMe, SendMessage, *},
requests::Request,
types::*,
};
use crate::{payloads::*, requests::Request, types::*};
/// Telegram Bot API client.
///

View file

@ -1,16 +0,0 @@
use bytes::{Bytes, BytesMut};
use tokio_util::codec::Decoder;
struct FileDecoder;
impl Decoder for FileDecoder {
type Item = Bytes;
type Error = std::io::Error;
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
if src.is_empty() {
return Ok(None);
}
Ok(Some(src.split().freeze()))
}
}

View file

@ -268,16 +268,12 @@ pub use user_id::*;
use serde::Serialize;
/// Converts an `i64` timestump to a `choro::DateTime`, producing serde error
/// for invalid timestumps
/// Converts an `i64` timestamp to a `choro::DateTime`, producing serde error
/// for invalid timestamps
pub(crate) fn serde_timestamp<E: serde::de::Error>(
timestamp: i64,
) -> Result<chrono::DateTime<chrono::Utc>, E> {
use chrono::{DateTime, NaiveDateTime, Utc};
NaiveDateTime::from_timestamp_opt(timestamp, 0)
.ok_or_else(|| E::custom("invalid timestump"))
.map(|naive| DateTime::from_naive_utc_and_offset(naive, Utc))
chrono::DateTime::from_timestamp(timestamp, 0).ok_or_else(|| E::custom("invalid timestump"))
}
pub(crate) mod serde_opt_date_from_unix_timestamp {
@ -313,10 +309,7 @@ pub(crate) mod serde_opt_date_from_unix_timestamp {
{
let json = r#"{"date":1}"#;
let expected = DateTime::from_naive_utc_and_offset(
chrono::NaiveDateTime::from_timestamp_opt(1, 0).unwrap(),
Utc,
);
let expected = DateTime::from_timestamp(1, 0).unwrap();
let Struct { date } = serde_json::from_str(json).unwrap();
assert_eq!(date, Some(expected));

View file

@ -36,8 +36,6 @@ pub struct Animation {
#[cfg(test)]
mod tests {
use crate::types::FileMeta;
use super::*;
#[test]

View file

@ -36,8 +36,6 @@ pub struct Audio {
#[cfg(test)]
mod tests {
use crate::types::{FileMeta, Seconds};
use super::*;
#[test]

View file

@ -702,7 +702,7 @@ mod tests {
can_invite_users: true,
can_pin_messages: true,
until_date: UntilDate::Date(
chrono::NaiveDateTime::from_timestamp_opt(1620000000, 0).unwrap().and_utc(),
chrono::DateTime::from_timestamp(1620000000, 0).unwrap(),
),
}),
};

View file

@ -15,15 +15,8 @@ use tokio::{
use tokio_util::codec::{Decoder, FramedRead};
use std::{
borrow::Cow,
convert::{Infallible, TryFrom},
fmt,
future::Future,
io, iter, mem,
path::PathBuf,
pin::Pin,
sync::Arc,
task,
borrow::Cow, convert::Infallible, fmt, future::Future, io, iter, mem, path::PathBuf, pin::Pin,
sync::Arc, task,
};
use crate::types::InputSticker;

View file

@ -1748,7 +1748,7 @@ mod tests {
Message {
id: MessageId(198283),
thread_id: None,
date: chrono::NaiveDateTime::from_timestamp_opt(1567927221, 0).unwrap().and_utc(),
date: chrono::DateTime::from_timestamp(1567927221, 0).unwrap(),
chat: Chat {
id: ChatId(250918540),
kind: ChatKind::Private(ChatPrivate {

View file

@ -264,7 +264,6 @@ pub enum MessageEntityKind {
mod tests {
use super::*;
use cool_asserts::assert_matches;
use MessageEntity;
use MessageEntityKind::*;
#[test]

View file

@ -2,10 +2,7 @@
// (for built ins there no warnings, but for (De)Serialize, there are)
#![allow(deprecated)]
use std::{
convert::{TryFrom, TryInto},
str::FromStr,
};
use std::str::FromStr;
use serde::{Deserialize, Serialize};
@ -184,8 +181,8 @@ impl FromStr for ParseMode {
}
#[cfg(test)]
#[allow(deprecated)]
mod tests {
#![allow(deprecated)]
use super::*;

View file

@ -20,7 +20,6 @@ pub enum ResponseParameters {
#[cfg(test)]
mod tests {
use super::*;
use crate::types::{ChatId, Seconds};
#[test]
fn migrate_to_chat_id_deserialization() {

View file

@ -26,8 +26,11 @@ impl Seconds {
}
/// Returns [`chrono::Duration`] equivalent of this duration.
// FIXME: rename to `time_delta` (the new name of `chrono::Duration`)?
pub fn chrono_duration(self) -> chrono::Duration {
chrono::Duration::seconds(self.seconds() as i64)
// Unwrap: `self.seconds()` is a `u32`, which is always between `-i64::MAX/1000`
// and `i64::MAX/1000`
chrono::Duration::try_seconds(self.seconds() as i64).unwrap()
}
}

View file

@ -1,4 +1,4 @@
use std::{convert::TryFrom, ops::Deref};
use std::ops::Deref;
use serde::{Deserialize, Serialize};

View file

@ -384,16 +384,13 @@ mod test {
MessageId, MessageKind, Update, UpdateId, UpdateKind, User, UserId,
};
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::DateTime;
// TODO: more tests for deserialization
#[test]
fn message() {
let timestamp = 1_569_518_342;
let date = DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap(),
Utc,
);
let date = DateTime::from_timestamp(timestamp, 0).unwrap();
let json = r#"{
"update_id":892252934,

View file

@ -1,5 +1,3 @@
use std::iter::FromIterator;
pub(crate) struct Unzip<A, B>(pub A, pub B);
impl<A, B, T, U> FromIterator<(T, U)> for Unzip<A, B>

View file

@ -129,9 +129,11 @@ async fn mute_user(bot: Bot, msg: Message, time: Duration) -> ResponseResult<()>
// Calculates time of user restriction.
fn calc_restrict_time(time: u64, unit: UnitOfTime) -> Duration {
// FIXME: actually handle the case of too big integers correctly, instead of
// unwrapping
match unit {
UnitOfTime::Hours => Duration::hours(time as i64),
UnitOfTime::Minutes => Duration::minutes(time as i64),
UnitOfTime::Seconds => Duration::seconds(time as i64),
UnitOfTime::Hours => Duration::try_hours(time as i64).unwrap(),
UnitOfTime::Minutes => Duration::try_minutes(time as i64).unwrap(),
UnitOfTime::Seconds => Duration::try_seconds(time as i64).unwrap(),
}
}

View file

@ -1,9 +1,4 @@
use teloxide::{
dispatching::Dispatcher,
prelude::*,
types::{ChatMemberUpdated, ParseMode, Update},
utils::html,
};
use teloxide::{prelude::*, types::ParseMode, utils::html};
use teloxide_core::adaptors::DefaultParseMode;
/// We use a type alias to be able to write just `bot: Bot` in handlers, instead

View file

@ -3,11 +3,7 @@
use rand::Rng;
use teloxide::{
prelude::*,
types::{Dice, Update, UserId},
utils::command::BotCommands,
};
use teloxide::{prelude::*, types::Dice, utils::command::BotCommands};
#[tokio::main]
async fn main() {

View file

@ -3,7 +3,6 @@ use teloxide::{
types::{
InlineQueryResult, InlineQueryResultArticle, InputMessageContent, InputMessageContentText,
},
Bot,
};
#[tokio::main]

View file

@ -1,8 +1,4 @@
use std::{
fmt::Debug,
marker::{Send, Sync},
sync::Arc,
};
use std::{fmt::Debug, sync::Arc};
use futures::future::BoxFuture;
use teloxide_core::types::ChatId;

View file

@ -1,5 +1,4 @@
use std::{
convert::TryInto,
future::Future,
mem,
pin::Pin,

View file

@ -115,8 +115,6 @@ pub fn user_mention_or_link(user: &User) -> String {
#[cfg(test)]
mod tests {
use teloxide_core::types::UserId;
use super::*;
#[test]

View file

@ -157,7 +157,6 @@ pub fn user_mention_or_link(user: &User) -> String {
#[cfg(test)]
mod tests {
use super::*;
use teloxide_core::types::{User, UserId};
#[test]
fn test_bold() {

View file

@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2023-09-27"
channel = "nightly-2024-03-20"
components = ["rustfmt", "clippy"]
profile = "minimal"