diff options
| author | Michael Krasnitski <michael.krasnitski@gmail.com> | 2022-08-11 22:41:25 -0400 |
|---|---|---|
| committer | Michael Krasnitski <michael.krasnitski@gmail.com> | 2022-08-11 22:41:25 -0400 |
| commit | f7f60b82e8d9ce281f67cef8b95019482ff47298 (patch) | |
| tree | 1fd33513d9dbac9a00389d050734e3483c78bb48 | |
| parent | 80f0f280df446d5b4169d1cf1314b030f52c02c1 (diff) | |
| download | rust-f7f60b82e8d9ce281f67cef8b95019482ff47298.tar.gz rust-f7f60b82e8d9ce281f67cef8b95019482ff47298.zip | |
Adjust lint description for better clarity
| -rw-r--r-- | clippy_lints/src/if_then_some_else_none.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clippy_lints/src/if_then_some_else_none.rs b/clippy_lints/src/if_then_some_else_none.rs index 20fcba90773..11c43247868 100644 --- a/clippy_lints/src/if_then_some_else_none.rs +++ b/clippy_lints/src/if_then_some_else_none.rs @@ -11,10 +11,12 @@ use rustc_session::{declare_tool_lint, impl_lint_pass}; declare_clippy_lint! { /// ### What it does - /// Checks for if-else that could be written to `bool::then`. + /// Checks for if-else that could be written using either `bool::then` or `bool::then_some`. /// /// ### Why is this bad? - /// Looks a little redundant. Using `bool::then` helps it have less lines of code. + /// Looks a little redundant. Using `bool::then` is more concise and incurs no loss of clarity. + /// For simple calculations and known values, use `bool::then_some`, which is eagerly evaluated + /// in comparison to `bool::then`. /// /// ### Example /// ```rust @@ -39,7 +41,7 @@ declare_clippy_lint! { #[clippy::version = "1.53.0"] pub IF_THEN_SOME_ELSE_NONE, restriction, - "Finds if-else that could be written using `bool::then`" + "Finds if-else that could be written using either `bool::then` or `bool::then_some`" } pub struct IfThenSomeElseNone { |
