From 55c02e3311221182db46219c93479c0097f778b3 Mon Sep 17 00:00:00 2001 From: Waffle Date: Sat, 23 Jan 2021 15:45:58 +0300 Subject: [PATCH 1/2] Use edition-2018 style modules Use `module_name.rs` instead of `module_name/mod.rs`. Pros: - It's easier to find the module file (especially for modules with lots of submodules like `types`) - Module file name is not 'magical' --- src/{bot/mod.rs => bot.rs} | 0 src/{net/mod.rs => net.rs} | 0 src/{payloads/mod.rs => payloads.rs} | 0 src/{requests/mod.rs => requests.rs} | 0 src/{types/mod.rs => types.rs} | 9 +++++++-- src/types/non_telegram_types/mod.rs | 9 --------- 6 files changed, 7 insertions(+), 11 deletions(-) rename src/{bot/mod.rs => bot.rs} (100%) rename src/{net/mod.rs => net.rs} (100%) rename src/{payloads/mod.rs => payloads.rs} (100%) rename src/{requests/mod.rs => requests.rs} (100%) rename src/{types/mod.rs => types.rs} (95%) delete mode 100644 src/types/non_telegram_types/mod.rs diff --git a/src/bot/mod.rs b/src/bot.rs similarity index 100% rename from src/bot/mod.rs rename to src/bot.rs diff --git a/src/net/mod.rs b/src/net.rs similarity index 100% rename from src/net/mod.rs rename to src/net.rs diff --git a/src/payloads/mod.rs b/src/payloads.rs similarity index 100% rename from src/payloads/mod.rs rename to src/payloads.rs diff --git a/src/requests/mod.rs b/src/requests.rs similarity index 100% rename from src/requests/mod.rs rename to src/requests.rs diff --git a/src/types/mod.rs b/src/types.rs similarity index 95% rename from src/types/mod.rs rename to src/types.rs index 52bf56a2..05430052 100644 --- a/src/types/mod.rs +++ b/src/types.rs @@ -190,5 +190,10 @@ mod passport_data; mod passport_element_error; mod passport_file; -pub use non_telegram_types::*; -mod non_telegram_types; +pub use non_telegram_types::{country_code::*, currency::*, non_strict_vec::*}; +mod non_telegram_types { + pub(super) mod country_code; + pub(super) mod currency; + pub(crate) mod mime; + pub(super) mod non_strict_vec; +} diff --git a/src/types/non_telegram_types/mod.rs b/src/types/non_telegram_types/mod.rs deleted file mode 100644 index 49360c4f..00000000 --- a/src/types/non_telegram_types/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub use country_code::*; -pub use currency::*; -pub use non_strict_vec::*; - -mod country_code; -mod currency; -mod non_strict_vec; - -pub(crate) mod mime; From 1f4d29c547ccb61e9d0958079dd5cb82e62ff502 Mon Sep 17 00:00:00 2001 From: Waffle Date: Sat, 23 Jan 2021 15:59:59 +0300 Subject: [PATCH 2/2] Add note that serde_multipart is awful --- src/serde_multipart/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/serde_multipart/mod.rs b/src/serde_multipart/mod.rs index 814dc906..dcee7ef1 100644 --- a/src/serde_multipart/mod.rs +++ b/src/serde_multipart/mod.rs @@ -6,6 +6,9 @@ //! ## How it works //! //! You better not know... +//! +//! This whole module is an awful hack and we'll probably stop using it in next +//! versions (in favor of something less automatic, but more simple). mod serializers; mod unserializers;