From d0add19b293143a9b599fce6260ae226b9d619a0 Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Sat, 20 Aug 2022 16:16:08 +0600 Subject: [PATCH] Avoid ending punctuation in short list items --- CODE_STYLE.md | 26 +++++++++++++++++++++++++- src/dispatching.rs | 24 ++++++++++++------------ src/dispatching/repls/commands_repl.rs | 4 ++-- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 0fa0756b..503844c2 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -42,7 +42,31 @@ Good: pub fn make_request(url: &str) -> String { ... } ``` - 2. Also, link resources in your comments when possible: + 2. Do not use ending punctuation in short list items (usually containing just one phrase or sentence). Bad: + +```md + - Handle different kinds of Update. + - Pass dependencies to handlers. + - Disable a default Ctrl-C handling. +``` + +Bad: + +```md + - Handle different kinds of Update; + - Pass dependencies to handlers; + - Disable a default Ctrl-C handling. +``` + +Good: + +```md + - Handle different kinds of Update + - Pass dependencies to handlers + - Disable a default Ctrl-C handling +``` + + 3. Link resources in your comments when possible: ```rust /// Download a file from Telegram. diff --git a/src/dispatching.rs b/src/dispatching.rs index 18bf5eab..0fe237bd 100644 --- a/src/dispatching.rs +++ b/src/dispatching.rs @@ -153,12 +153,12 @@ //! //! //! Each parameter is supplied as a dependency by teloxide. In particular: -//! - `bot: AutoSend` comes from the dispatcher (see below); -//! - `msg: Message` comes from [`Update::filter_message`]; -//! - `q: CallbackQuery` comes from [`Update::filter_callback_query`]; -//! - `dialogue: MyDialogue` comes from [`dialogue::enter`]; +//! - `bot: AutoSend` comes from the dispatcher (see below) +//! - `msg: Message` comes from [`Update::filter_message`] +//! - `q: CallbackQuery` comes from [`Update::filter_callback_query`] +//! - `dialogue: MyDialogue` comes from [`dialogue::enter`] //! - `full_name: String` comes from `dptree::case![State::ReceiveProductChoice -//! { full_name }]`. +//! { full_name }]` //! //! Inside `main`, we plug the schema into [`Dispatcher`] like this: //! @@ -199,13 +199,13 @@ //! bit more complicated setup. //! //! Here are things that dispatching can do, but REPLs can't: -//! - Handle different kinds of [`Update`]; -//! - [Pass dependencies] to handlers; -//! - Disable a [default Ctrl-C handling]; -//! - Control your [default] and [error] handlers; -//! - Use [dialogues]. -//! - Use [`dptree`]-related functionality. -//! - Probably more. +//! - Handle different kinds of [`Update`] +//! - [Pass dependencies] to handlers +//! - Disable a [default Ctrl-C handling] +//! - Control your [default] and [error] handlers +//! - Use [dialogues] +//! - Use [`dptree`]-related functionality +//! - Probably more //! //! Thus, REPLs are good for simple bots and rapid prototyping, but for more //! involved scenarios, we recommend using dispatching over REPLs. diff --git a/src/dispatching/repls/commands_repl.rs b/src/dispatching/repls/commands_repl.rs index 9f8f9b93..fb89b21a 100644 --- a/src/dispatching/repls/commands_repl.rs +++ b/src/dispatching/repls/commands_repl.rs @@ -29,7 +29,7 @@ use teloxide_core::requests::Requester; /// /// ## Dependency requirements /// -/// - Those of [`HandlerExt::filter_command`]. +/// - Those of [`HandlerExt::filter_command`] /// /// [REPL]: https://en.wikipedia.org/wiki/Read-eval-print_loop /// [`Dispatcher`]: crate::dispatching::Dispatcher @@ -72,7 +72,7 @@ where /// /// ## Dependency requirements /// -/// - Those of [`HandlerExt::filter_command`]. +/// - Those of [`HandlerExt::filter_command`] /// /// [`Dispatcher`]: crate::dispatching::Dispatcher /// [`commands_repl`]: crate::dispatching::repls::commands_repl()