about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-29 09:07:51 +0000
committerbors <bors@rust-lang.org>2023-10-29 09:07:51 +0000
commitfa6fd8c346ed5b83d3411880ff5f473a27e689eb (patch)
tree2371d155c76b61b89987e6a6d72e588c6902bd01
parenta40958a5982e2cd76235239af6a5b0edb78eab89 (diff)
parent58fe45102de21fb0806f7f58e85ce1f4ec7e490e (diff)
downloadrust-fa6fd8c346ed5b83d3411880ff5f473a27e689eb.tar.gz
rust-fa6fd8c346ed5b83d3411880ff5f473a27e689eb.zip
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
-rw-r--r--clippy_lints/src/panic_unimplemented.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs
index a72aefe91c1..f4f1f6ddb3f 100644
--- a/clippy_lints/src/panic_unimplemented.rs
+++ b/clippy_lints/src/panic_unimplemented.rs
@@ -9,7 +9,7 @@ declare_clippy_lint! {
     /// Checks for usage of `panic!`.
     ///
     /// ### Why is this bad?
-    /// `panic!` will stop the execution of the executable
+    /// `panic!` will stop the execution of the executable.
     ///
     /// ### Example
     /// ```no_run
@@ -26,7 +26,7 @@ declare_clippy_lint! {
     /// Checks for usage of `unimplemented!`.
     ///
     /// ### Why is this bad?
-    /// This macro should not be present in production code
+    /// This macro should not be present in production code.
     ///
     /// ### Example
     /// ```no_run
@@ -43,12 +43,17 @@ declare_clippy_lint! {
     /// Checks for usage of `todo!`.
     ///
     /// ### 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
     /// ```no_run
     /// todo!();
     /// ```
+    /// Finish the implementation, or consider marking it as explicitly unimplemented.
+    /// ```no_run
+    /// unimplemented!();
+    /// ```
     #[clippy::version = "1.40.0"]
     pub TODO,
     restriction,
@@ -60,7 +65,7 @@ declare_clippy_lint! {
     /// Checks for usage of `unreachable!`.
     ///
     /// ### Why is this bad?
-    /// This macro can cause code to panic
+    /// This macro can cause code to panic.
     ///
     /// ### Example
     /// ```no_run