Merge pull request #943 from teloxide/renight

Update nightly Rust
This commit is contained in:
Tima Kinsart 2023-09-29 13:58:05 +00:00 committed by GitHub
commit 716f3c131d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 47 additions and 47 deletions

View file

@ -19,7 +19,7 @@ env:
# When updating this, also update:
# - crates/teloxide-core/src/codegen.rs
# - rust-toolchain.toml
rust_nightly: nightly-2023-05-28
rust_nightly: nightly-2023-09-27
# When updating this, also update:
# - **/README.md
# - **/src/lib.rs
@ -84,7 +84,7 @@ jobs:
toolchain: beta
features: "--features full"
- rust: nightly
toolchain: nightly-2023-05-28
toolchain: nightly-2023-09-27
features: "--features full nightly"
- rust: msrv
toolchain: 1.65.0

View file

@ -1,6 +1,6 @@
[workspace]
members = ["crates/*"]
resolver = "2"
# The settings below will be applied to all crates in the workspace
[workspace.package]

View file

@ -155,18 +155,18 @@ pub(super) async fn worker<B>(
//
// Reasons (not to use `spawn_blocking`):
//
// 1. The work seems not very CPU-bound, it's not heavy computations,
// it's more like light computations.
// 1. The work seems not very CPU-bound, it's not heavy computations, it's more
// like light computations.
//
// 2. `spawn_blocking` is not zero-cost — it spawns a new system thread
// + do so other work. This may actually be *worse* then current
// "just do everything in this async fn" approach.
//
// 3. With `rt-threaded` feature, tokio uses [`num_cpus()`] threads
// which should be enough to work fine with one a-bit-blocking task.
// Crucially current behaviour will be problem mostly with
// single-threaded runtimes (and in case you're using one, you
// probably don't want to spawn unnecessary threads anyway).
// 3. With `rt-threaded` feature, tokio uses [`num_cpus()`] threads which should
// be enough to work fine with one a-bit-blocking task. Crucially current
// behaviour will be problem mostly with single-threaded runtimes (and in
// case you're using one, you probably don't want to spawn unnecessary
// threads anyway).
//
// I think if we'll ever change this behaviour, we need to make it
// _configurable_.

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-05-28";
let toolchain = "nightly-2023-09-27";
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-05-28";
let toolchain = "nightly-2023-09-27";
let sh = Shell::new().unwrap();
ensure_rustfmt(&sh);

View file

@ -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,

View file

@ -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!(

View file

@ -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,

View file

@ -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);

View file

@ -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).

View file

@ -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)

View file

@ -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");
}
}

View file

@ -18,12 +18,12 @@ proc-macro = true
[dependencies]
quote = "1.0.7"
proc-macro2 = "1.0.19"
syn = { version = "1.0.13", features = ["full"] }
proc-macro2 = "1.0.67"
syn = { version = "1.0.13", features = ["full"] }
heck = "0.4.0"
[package.metadata.release]
tag-prefix = "macros-"
pre-release-replacements = [
{file="CHANGELOG.md", search="## unreleased", replace="## unreleased\n\n## {{version}} - {{date}}", exactly=1},
{ file = "CHANGELOG.md", search = "## unreleased", replace = "## unreleased\n\n## {{version}} - {{date}}", exactly = 1 },
]

View file

@ -19,10 +19,7 @@ pub(crate) fn fold_attrs<A, R>(
.filter(|&a| filter(a))
.flat_map(|attribute| {
let Some(key) = attribute.path.get_ident().cloned() else {
return vec![Err(compile_error_at(
"expected an ident",
attribute.path.span(),
))];
return vec![Err(compile_error_at("expected an ident", attribute.path.span()))];
};
match (|input: ParseStream<'_>| Attrs::parse_with_key(input, key))

View file

@ -145,13 +145,12 @@ impl CommandAttr {
}
"command" => {
let Some(attr) = key.pop()
else {
return Err(compile_error_at(
"expected an attribute name",
outermost_key.span(),
))
};
let Some(attr) = key.pop() else {
return Err(compile_error_at(
"expected an attribute name",
outermost_key.span(),
));
};
if let Some(unexpected_key) = key.last() {
return Err(compile_error_at(

View file

@ -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),

View file

@ -165,9 +165,9 @@ where
/// the [`Requester`] trait.
/// 2. `handler` is an `async` function that takes arguments from
/// [`DependencyMap`] (see below) and returns [`ResponseResult`].
/// 3. `cmd` is a type hint for your command enumeration
/// `MyCommand`: just write `MyCommand::ty()`. Note that `MyCommand` must
/// implement the [`BotCommands`] trait, typically via
/// 3. `cmd` is a type hint for your command enumeration `MyCommand`: just write
/// `MyCommand::ty()`. Note that `MyCommand` must implement the
/// [`BotCommands`] trait, typically via
/// `#[derive(BotCommands)]`.
///
/// All the other requirements are about thread safety and data validity and can
@ -236,8 +236,8 @@ where
/// [`DependencyMap`] (see below) and returns [`ResponseResult`].
/// 3. `listener` is something that takes updates from a Telegram server and
/// implements [`UpdateListener`].
/// 4. `cmd` is a type hint for your command enumeration `MyCommand`: just
/// write `MyCommand::ty()`. Note that `MyCommand` must implement the
/// 4. `cmd` is a type hint for your command enumeration `MyCommand`: just write
/// `MyCommand::ty()`. Note that `MyCommand` must implement the
/// [`BotCommands`] trait, typically via `#[derive(BotCommands)]`.
///
/// All the other requirements are about thread safety and data validity and can

View file

@ -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)")
}
}

View file

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