Auto merge of #11726 - Wilfred:todo_docs, r=dswij

Expand docs on clippy::todo

https://doc.rust-lang.org/nightly/core/macro.todo.html describes that `todo!()` is intended for explicitly unfinished code. Explain this, and mention `unimplemented!()` as an alternative.

Whilst we're here, improve the punctuation on the other lints.

changelog: [`todo`]: expand docs
This commit is contained in:
bors 2023-10-29 09:07:51 +00:00
commit fa6fd8c346

View file

@ -9,7 +9,7 @@ declare_clippy_lint! {
/// Checks for usage of `panic!`. /// Checks for usage of `panic!`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// `panic!` will stop the execution of the executable /// `panic!` will stop the execution of the executable.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -26,7 +26,7 @@ declare_clippy_lint! {
/// Checks for usage of `unimplemented!`. /// Checks for usage of `unimplemented!`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// This macro should not be present in production code /// This macro should not be present in production code.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -43,12 +43,17 @@ declare_clippy_lint! {
/// Checks for usage of `todo!`. /// Checks for usage of `todo!`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// This macro should not be present in production code /// The `todo!` macro is often used for unfinished code, and it causes
/// code to panic. It should not be present in production code.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
/// todo!(); /// todo!();
/// ``` /// ```
/// Finish the implementation, or consider marking it as explicitly unimplemented.
/// ```no_run
/// unimplemented!();
/// ```
#[clippy::version = "1.40.0"] #[clippy::version = "1.40.0"]
pub TODO, pub TODO,
restriction, restriction,
@ -60,7 +65,7 @@ declare_clippy_lint! {
/// Checks for usage of `unreachable!`. /// Checks for usage of `unreachable!`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// This macro can cause code to panic /// This macro can cause code to panic.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run