Skip to content

Commit fa6fd8c

Browse files
committed
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
2 parents a40958a + 58fe451 commit fa6fd8c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clippy_lints/src/panic_unimplemented.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare_clippy_lint! {
99
/// Checks for usage of `panic!`.
1010
///
1111
/// ### Why is this bad?
12-
/// `panic!` will stop the execution of the executable
12+
/// `panic!` will stop the execution of the executable.
1313
///
1414
/// ### Example
1515
/// ```no_run
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
/// Checks for usage of `unimplemented!`.
2727
///
2828
/// ### Why is this bad?
29-
/// This macro should not be present in production code
29+
/// This macro should not be present in production code.
3030
///
3131
/// ### Example
3232
/// ```no_run
@@ -43,12 +43,17 @@ declare_clippy_lint! {
4343
/// Checks for usage of `todo!`.
4444
///
4545
/// ### Why is this bad?
46-
/// This macro should not be present in production code
46+
/// The `todo!` macro is often used for unfinished code, and it causes
47+
/// code to panic. It should not be present in production code.
4748
///
4849
/// ### Example
4950
/// ```no_run
5051
/// todo!();
5152
/// ```
53+
/// Finish the implementation, or consider marking it as explicitly unimplemented.
54+
/// ```no_run
55+
/// unimplemented!();
56+
/// ```
5257
#[clippy::version = "1.40.0"]
5358
pub TODO,
5459
restriction,
@@ -60,7 +65,7 @@ declare_clippy_lint! {
6065
/// Checks for usage of `unreachable!`.
6166
///
6267
/// ### Why is this bad?
63-
/// This macro can cause code to panic
68+
/// This macro can cause code to panic.
6469
///
6570
/// ### Example
6671
/// ```no_run

0 commit comments

Comments
 (0)