mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
Adjust lint description for better clarity
This commit is contained in:
parent
80f0f280df
commit
f7f60b82e8
1 changed files with 5 additions and 3 deletions
|
@ -11,10 +11,12 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### 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?
|
/// ### 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
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
@ -39,7 +41,7 @@ declare_clippy_lint! {
|
||||||
#[clippy::version = "1.53.0"]
|
#[clippy::version = "1.53.0"]
|
||||||
pub IF_THEN_SOME_ELSE_NONE,
|
pub IF_THEN_SOME_ELSE_NONE,
|
||||||
restriction,
|
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 {
|
pub struct IfThenSomeElseNone {
|
||||||
|
|
Loading…
Add table
Reference in a new issue