diff --git a/src/codegen/patch.rs b/src/codegen/patch.rs index 666ecf99..a235fcd2 100644 --- a/src/codegen/patch.rs +++ b/src/codegen/patch.rs @@ -239,7 +239,7 @@ fn intra_links(doc: &mut Doc) { match () { _ if k == "games" => {} _ if k == "unbanned" => *v = String::from("crate::payloads::UnbanChatMember"), - _ if c.is_lowercase() && !["update"].contains(&&&**k) => { + _ if c.is_lowercase() && !["update"].contains(&&**k) => { repls_m.push(k.clone()); *v = format!("crate::payloads::{}", to_uppercase(k)); } diff --git a/src/lib.rs b/src/lib.rs index 20080d1d..4b65f9c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,6 +88,7 @@ #![cfg_attr(all(feature = "full", docsrs), deny(rustdoc::broken_intra_doc_links))] //#![deny(missing_docs)] #![warn(clippy::print_stdout, clippy::dbg_macro)] +#![allow(clippy::let_and_return)] // Unless this becomes machine applicable, I'm not adding 334 #[must_use]s (waffle) #![allow(clippy::return_self_not_must_use)] // Workaround for CI diff --git a/src/local_macros.rs b/src/local_macros.rs index 18ab5103..a1d668cb 100644 --- a/src/local_macros.rs +++ b/src/local_macros.rs @@ -1251,7 +1251,7 @@ fn codegen_requester_forward() { .map(|(name, _)| &**name) .collect::>(); - convert_params.sort(); + convert_params.sort_unstable(); let prefixes: IndexMap<_, _> = convert_params .iter() @@ -1259,7 +1259,7 @@ fn codegen_requester_forward() { // Workaround to output the last type as the first letter .chain(["\0"]) .tuple_windows() - .map(|(l, r)| (l, min_prefix(&l, &r))) + .map(|(l, r)| (l, min_prefix(l, r))) .collect(); let args = m @@ -1287,12 +1287,12 @@ fn codegen_requester_forward() { Convert::Id(_) => None, Convert::Into(ty) => Some(format!( "{}: Into<{}>", - &to_uppercase(&prefixes[&*p.name]), + &to_uppercase(prefixes[&*p.name]), ty )), Convert::Collect(ty) => Some(format!( "{}: IntoIterator", - &to_uppercase(&prefixes[&*p.name]), + &to_uppercase(prefixes[&*p.name]), ty )), }) diff --git a/src/payloads/codegen.rs b/src/payloads/codegen.rs index b1c6a86c..c4e266d1 100644 --- a/src/payloads/codegen.rs +++ b/src/payloads/codegen.rs @@ -58,14 +58,14 @@ fn codegen_payloads() { let multipart = multipart_input_file_fields(&method) .map(|field| format!(" @[multipart = {}]\n", field.join(", "))) - .unwrap_or(String::new()); + .unwrap_or_else(String::new); let derive = if !multipart.is_empty() || matches!( &*method.names.1, "SendMediaGroup" | "EditMessageMedia" | "EditMessageMediaInline" ) { - format!("#[derive(Debug, Clone, Serialize)]") + "#[derive(Debug, Clone, Serialize)]".to_owned() } else { format!("#[derive(Debug, PartialEq,{eq_hash_derive}{default_derive} Clone, Serialize)]") }; @@ -116,7 +116,7 @@ fn uses(method: &Method) -> String { | Type::bool | Type::String => Use::Prelude, Type::Option(inner) | Type::ArrayOf(inner) => ty_use(inner), - Type::RawTy(raw) => Use::Crate(["use crate::types::", &raw, ";"].concat()), + Type::RawTy(raw) => Use::Crate(["use crate::types::", raw, ";"].concat()), Type::Url => Use::External(String::from("use url::Url;")), Type::DateTime => Use::External(String::from("use chrono::{DateTime, Utc};")), } @@ -175,7 +175,7 @@ fn render_doc(doc: &Doc, sibling: Option<&str>) -> String { [ " /// ", - &doc.md.replace("\n", "\n /// "), + &doc.md.replace('\n', "\n /// "), &sibling_note, &links, ] @@ -218,7 +218,7 @@ fn params(params: impl Iterator>) -> String { params .map(|param| { let param = param.borrow(); - let doc = render_doc(¶m.descr, None).replace("\n", "\n "); + let doc = render_doc(¶m.descr, None).replace('\n', "\n "); let field = ¶m.name; let ty = ¶m.ty; let flatten = match ty { diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 2d611b65..bafb7b01 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -1142,7 +1142,7 @@ fn codegen_requester_methods() { .map(|(name, _)| &**name) .collect::>(); - convert_params.sort(); + convert_params.sort_unstable(); let prefixes: IndexMap<_, _> = convert_params .iter() @@ -1150,7 +1150,7 @@ fn codegen_requester_methods() { // Workaround to output the last type as the first letter .chain(["\0"]) .tuple_windows() - .map(|(l, r)| (l, min_prefix(&l, &r))) + .map(|(l, r)| (l, min_prefix(l, r))) .collect(); let args = m @@ -1178,12 +1178,12 @@ fn codegen_requester_methods() { Convert::Id(_) => None, Convert::Into(ty) => Some(format!( "{}: Into<{}>", - &to_uppercase(&prefixes[&*p.name]), + &to_uppercase(prefixes[&*p.name]), ty )), Convert::Collect(ty) => Some(format!( "{}: IntoIterator", - &to_uppercase(&prefixes[&*p.name]), + &to_uppercase(prefixes[&*p.name]), ty )), })