Skip to content

Commit f7f60b8

Browse files
committed
Adjust lint description for better clarity
1 parent 80f0f28 commit f7f60b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clippy_lints/src/if_then_some_else_none.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
1111

1212
declare_clippy_lint! {
1313
/// ### What it does
14-
/// Checks for if-else that could be written to `bool::then`.
14+
/// Checks for if-else that could be written using either `bool::then` or `bool::then_some`.
1515
///
1616
/// ### Why is this bad?
17-
/// Looks a little redundant. Using `bool::then` helps it have less lines of code.
17+
/// Looks a little redundant. Using `bool::then` is more concise and incurs no loss of clarity.
18+
/// For simple calculations and known values, use `bool::then_some`, which is eagerly evaluated
19+
/// in comparison to `bool::then`.
1820
///
1921
/// ### Example
2022
/// ```rust
@@ -39,7 +41,7 @@ declare_clippy_lint! {
3941
#[clippy::version = "1.53.0"]
4042
pub IF_THEN_SOME_ELSE_NONE,
4143
restriction,
42-
"Finds if-else that could be written using `bool::then`"
44+
"Finds if-else that could be written using either `bool::then` or `bool::then_some`"
4345
}
4446

4547
pub struct IfThenSomeElseNone {

0 commit comments

Comments
 (0)