Fix CHANGELOG.md and lint names plural
This commit is contained in:
parent
93386563f6
commit
ab87f87ba0
22
CHANGELOG.md
22
CHANGELOG.md
@ -198,7 +198,7 @@ Released 2020-03-12
|
||||
|
||||
### Suggestion Improvements
|
||||
|
||||
* [`option_map_unwrap_or`] [#4634](https://github.com/rust-lang/rust-clippy/pull/4634)
|
||||
* `option_map_unwrap_or` [#4634](https://github.com/rust-lang/rust-clippy/pull/4634)
|
||||
* [`wildcard_enum_match_arm`] [#4934](https://github.com/rust-lang/rust-clippy/pull/4934)
|
||||
* [`cognitive_complexity`] [#4935](https://github.com/rust-lang/rust-clippy/pull/4935)
|
||||
* [`decimal_literal_representation`] [#4956](https://github.com/rust-lang/rust-clippy/pull/4956)
|
||||
@ -282,8 +282,8 @@ Released 2019-12-19
|
||||
* [`panic`] [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* [`unreachable`] [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* [`todo`] [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* [`option_expect_used`] [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* [`result_expect_used`] [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* `option_expect_used` [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* `result_expect_used` [#4657](https://github.com/rust-lang/rust-clippy/pull/4657)
|
||||
* Move `redundant_clone` to perf group [#4509](https://github.com/rust-lang/rust-clippy/pull/4509)
|
||||
* Move `manual_mul_add` to nursery group [#4736](https://github.com/rust-lang/rust-clippy/pull/4736)
|
||||
* Expand `unit_cmp` to also work with `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` [#4613](https://github.com/rust-lang/rust-clippy/pull/4613)
|
||||
@ -395,7 +395,7 @@ Released 2019-08-15
|
||||
* Fix false positive in [`useless_attribute`] [#4107](https://github.com/rust-lang/rust-clippy/pull/4107)
|
||||
* Fix incorrect suggestion for [`float_cmp`] [#4214](https://github.com/rust-lang/rust-clippy/pull/4214)
|
||||
* Add suggestions for [`print_with_newline`] and [`write_with_newline`] [#4136](https://github.com/rust-lang/rust-clippy/pull/4136)
|
||||
* Improve suggestions for [`option_map_unwrap_or_else`] and [`result_map_unwrap_or_else`] [#4164](https://github.com/rust-lang/rust-clippy/pull/4164)
|
||||
* Improve suggestions for `option_map_unwrap_or_else` and `result_map_unwrap_or_else` [#4164](https://github.com/rust-lang/rust-clippy/pull/4164)
|
||||
* Improve suggestions for [`non_ascii_literal`] [#4119](https://github.com/rust-lang/rust-clippy/pull/4119)
|
||||
* Improve diagnostics for [`let_and_return`] [#4137](https://github.com/rust-lang/rust-clippy/pull/4137)
|
||||
* Improve diagnostics for [`trivially_copy_pass_by_ref`] [#4071](https://github.com/rust-lang/rust-clippy/pull/4071)
|
||||
@ -448,7 +448,7 @@ Released 2019-05-20
|
||||
* Fix false positive in [`needless_range_loop`] pertaining to structs without a `.iter()`
|
||||
* Fix false positive in [`bool_comparison`] pertaining to non-bool types
|
||||
* Fix false positive in [`redundant_closure`] pertaining to differences in borrows
|
||||
* Fix false positive in [`option_map_unwrap_or`] on non-copy types
|
||||
* Fix false positive in `option_map_unwrap_or` on non-copy types
|
||||
* Fix false positives in [`missing_const_for_fn`] pertaining to macros and trait method impls
|
||||
* Fix false positive in [`needless_pass_by_value`] pertaining to procedural macros
|
||||
* Fix false positive in [`needless_continue`] pertaining to loop labels
|
||||
@ -794,7 +794,7 @@ Released 2018-09-13
|
||||
|
||||
## 0.0.169
|
||||
* Rustup to *rustc 1.23.0-nightly (3b82e4c74 2017-11-05)*
|
||||
* New lints: [`just_underscores_and_digits`], [`result_map_unwrap_or_else`], [`transmute_bytes_to_str`]
|
||||
* New lints: [`just_underscores_and_digits`], `result_map_unwrap_or_else`, [`transmute_bytes_to_str`]
|
||||
|
||||
## 0.0.168
|
||||
* Rustup to *rustc 1.23.0-nightly (f0fe716db 2017-10-30)*
|
||||
@ -1068,7 +1068,7 @@ Released 2018-09-13
|
||||
|
||||
## 0.0.93 — 2016-10-03
|
||||
* Rustup to *rustc 1.14.0-nightly (144af3e97 2016-10-02)*
|
||||
* [`option_map_unwrap_or`] and [`option_map_unwrap_or_else`] are now
|
||||
* `option_map_unwrap_or` and `option_map_unwrap_or_else` are now
|
||||
allowed by default.
|
||||
* New lint: [`explicit_into_iter_loop`]
|
||||
|
||||
@ -1087,8 +1087,8 @@ Released 2018-09-13
|
||||
## 0.0.88 — 2016-09-04
|
||||
* Rustup to *rustc 1.13.0-nightly (70598e04f 2016-09-03)*
|
||||
* The following lints are not new but were only usable through the `clippy`
|
||||
lint groups: [`filter_next`], [`for_loop_over_option`],
|
||||
[`for_loop_over_result`] and [`match_overlapping_arm`]. You should now be
|
||||
lint groups: [`filter_next`], `for_loop_over_option`,
|
||||
`for_loop_over_result` and [`match_overlapping_arm`]. You should now be
|
||||
able to `#[allow/deny]` them individually and they are available directly
|
||||
through `cargo clippy`.
|
||||
|
||||
@ -1274,7 +1274,7 @@ Released 2018-09-13
|
||||
[`await_holding_lock`]: https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
|
||||
[`bad_bit_mask`]: https://rust-lang.github.io/rust-clippy/master/index.html#bad_bit_mask
|
||||
[`blacklisted_name`]: https://rust-lang.github.io/rust-clippy/master/index.html#blacklisted_name
|
||||
[`block_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#block_in_if_condition
|
||||
[`blocks_in_if_conditions`]: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_if_conditions
|
||||
[`bool_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison
|
||||
[`borrow_interior_mutable_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrow_interior_mutable_const
|
||||
[`borrowed_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box
|
||||
@ -1361,7 +1361,7 @@ Released 2018-09-13
|
||||
[`fn_to_numeric_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast
|
||||
[`fn_to_numeric_cast_with_truncation`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast_with_truncation
|
||||
[`for_kv_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_kv_map
|
||||
[`for_loop_over_fallible`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loop_over_fallible
|
||||
[`for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
|
||||
[`forget_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_copy
|
||||
[`forget_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_ref
|
||||
[`future_not_send`]: https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
|
||||
|
@ -36,12 +36,12 @@ declare_clippy_lint! {
|
||||
/// let res = { let x = somefunc(); x };
|
||||
/// if res { /* ... */ }
|
||||
/// ```
|
||||
pub BLOCK_IN_IF_CONDITION,
|
||||
pub BLOCKS_IN_IF_CONDITIONS,
|
||||
style,
|
||||
"useless or complex blocks that can be eliminated in conditions"
|
||||
}
|
||||
|
||||
declare_lint_pass!(BlockInIfCondition => [BLOCK_IN_IF_CONDITION]);
|
||||
declare_lint_pass!(BlocksInIfConditions => [BLOCKS_IN_IF_CONDITIONS]);
|
||||
|
||||
struct ExVisitor<'a, 'tcx> {
|
||||
found_block: Option<&'tcx Expr<'tcx>>,
|
||||
@ -71,7 +71,7 @@ const BRACED_EXPR_MESSAGE: &str = "omit braces around single expression conditio
|
||||
const COMPLEX_BLOCK_MESSAGE: &str = "in an `if` condition, avoid complex blocks or closures with blocks; \
|
||||
instead, move the block or closure higher and bind it with a `let`";
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlocksInIfConditions {
|
||||
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if in_external_macro(cx.sess(), expr.span) {
|
||||
return;
|
||||
@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
BLOCK_IN_IF_CONDITION,
|
||||
BLOCKS_IN_IF_CONDITIONS,
|
||||
cond.span,
|
||||
BRACED_EXPR_MESSAGE,
|
||||
"try",
|
||||
@ -115,7 +115,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
BLOCK_IN_IF_CONDITION,
|
||||
BLOCKS_IN_IF_CONDITIONS,
|
||||
expr.span.with_hi(cond.span.hi()),
|
||||
COMPLEX_BLOCK_MESSAGE,
|
||||
"try",
|
||||
@ -137,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
|
||||
let mut visitor = ExVisitor { found_block: None, cx };
|
||||
walk_expr(&mut visitor, cond);
|
||||
if let Some(block) = visitor.found_block {
|
||||
span_lint(cx, BLOCK_IN_IF_CONDITION, block.span, COMPLEX_BLOCK_MESSAGE);
|
||||
span_lint(cx, BLOCKS_IN_IF_CONDITIONS, block.span, COMPLEX_BLOCK_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
@ -180,7 +180,7 @@ mod attrs;
|
||||
mod await_holding_lock;
|
||||
mod bit_mask;
|
||||
mod blacklisted_name;
|
||||
mod block_in_if_condition;
|
||||
mod blocks_in_if_conditions;
|
||||
mod booleans;
|
||||
mod bytecount;
|
||||
mod cargo_common_metadata;
|
||||
@ -507,7 +507,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
&bit_mask::INEFFECTIVE_BIT_MASK,
|
||||
&bit_mask::VERBOSE_BIT_MASK,
|
||||
&blacklisted_name::BLACKLISTED_NAME,
|
||||
&block_in_if_condition::BLOCK_IN_IF_CONDITION,
|
||||
&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
|
||||
&booleans::LOGIC_BUG,
|
||||
&booleans::NONMINIMAL_BOOL,
|
||||
&bytecount::NAIVE_BYTECOUNT,
|
||||
@ -615,7 +615,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
&loops::EXPLICIT_INTO_ITER_LOOP,
|
||||
&loops::EXPLICIT_ITER_LOOP,
|
||||
&loops::FOR_KV_MAP,
|
||||
&loops::FOR_LOOP_OVER_FALLIBLE,
|
||||
&loops::FOR_LOOPS_OVER_FALLIBLES,
|
||||
&loops::ITER_NEXT_LOOP,
|
||||
&loops::MANUAL_MEMCPY,
|
||||
&loops::MUT_RANGE_BOUND,
|
||||
@ -894,7 +894,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
store.register_late_pass(|| box mut_reference::UnnecessaryMutPassed);
|
||||
store.register_late_pass(|| box len_zero::LenZero);
|
||||
store.register_late_pass(|| box attrs::Attributes);
|
||||
store.register_late_pass(|| box block_in_if_condition::BlockInIfCondition);
|
||||
store.register_late_pass(|| box blocks_in_if_conditions::BlocksInIfConditions);
|
||||
store.register_late_pass(|| box unicode::Unicode);
|
||||
store.register_late_pass(|| box strings::StringAdd);
|
||||
store.register_late_pass(|| box implicit_return::ImplicitReturn);
|
||||
@ -1199,7 +1199,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
|
||||
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
|
||||
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
|
||||
LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION),
|
||||
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
|
||||
LintId::of(&booleans::LOGIC_BUG),
|
||||
LintId::of(&booleans::NONMINIMAL_BOOL),
|
||||
LintId::of(&bytecount::NAIVE_BYTECOUNT),
|
||||
@ -1264,7 +1264,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(&loops::EMPTY_LOOP),
|
||||
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
|
||||
LintId::of(&loops::FOR_KV_MAP),
|
||||
LintId::of(&loops::FOR_LOOP_OVER_FALLIBLE),
|
||||
LintId::of(&loops::FOR_LOOPS_OVER_FALLIBLES),
|
||||
LintId::of(&loops::ITER_NEXT_LOOP),
|
||||
LintId::of(&loops::MANUAL_MEMCPY),
|
||||
LintId::of(&loops::MUT_RANGE_BOUND),
|
||||
@ -1444,7 +1444,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
|
||||
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
|
||||
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
|
||||
LintId::of(&block_in_if_condition::BLOCK_IN_IF_CONDITION),
|
||||
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
|
||||
LintId::of(&collapsible_if::COLLAPSIBLE_IF),
|
||||
LintId::of(&comparison_chain::COMPARISON_CHAIN),
|
||||
LintId::of(&doc::MISSING_SAFETY_DOC),
|
||||
@ -1639,7 +1639,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
||||
LintId::of(&inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
|
||||
LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
|
||||
LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
|
||||
LintId::of(&loops::FOR_LOOP_OVER_FALLIBLE),
|
||||
LintId::of(&loops::FOR_LOOPS_OVER_FALLIBLES),
|
||||
LintId::of(&loops::ITER_NEXT_LOOP),
|
||||
LintId::of(&loops::NEVER_LOOP),
|
||||
LintId::of(&loops::WHILE_IMMUTABLE_CONDITION),
|
||||
@ -1785,8 +1785,8 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
|
||||
ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
|
||||
ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");
|
||||
ls.register_renamed("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes");
|
||||
ls.register_renamed("clippy::block_in_if_condition_expr", "clippy::block_in_if_condition");
|
||||
ls.register_renamed("clippy::block_in_if_condition_stmt", "clippy::block_in_if_condition");
|
||||
ls.register_renamed("clippy::block_in_if_condition_expr", "clippy::blocks_in_if_conditions");
|
||||
ls.register_renamed("clippy::block_in_if_condition_stmt", "clippy::blocks_in_if_conditions");
|
||||
ls.register_renamed("clippy::option_map_unwrap_or", "clippy::map_unwrap_or");
|
||||
ls.register_renamed("clippy::option_map_unwrap_or_else", "clippy::map_unwrap_or");
|
||||
ls.register_renamed("clippy::result_map_unwrap_or_else", "clippy::map_unwrap_or");
|
||||
@ -1794,8 +1794,8 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
|
||||
ls.register_renamed("clippy::result_unwrap_used", "clippy::unwrap_used");
|
||||
ls.register_renamed("clippy::option_expect_used", "clippy::expect_used");
|
||||
ls.register_renamed("clippy::result_expect_used", "clippy::expect_used");
|
||||
ls.register_renamed("clippy::for_loop_over_option", "clippy::for_loop_over_fallible");
|
||||
ls.register_renamed("clippy::for_loop_over_result", "clippy::for_loop_over_fallible");
|
||||
ls.register_renamed("clippy::for_loop_over_option", "clippy::for_loops_over_fallibles");
|
||||
ls.register_renamed("clippy::for_loop_over_result", "clippy::for_loops_over_fallibles");
|
||||
}
|
||||
|
||||
// only exists to let the dogfood integration test works.
|
||||
|
@ -205,7 +205,7 @@ declare_clippy_lint! {
|
||||
/// // ..
|
||||
/// }
|
||||
/// ```
|
||||
pub FOR_LOOP_OVER_FALLIBLE,
|
||||
pub FOR_LOOPS_OVER_FALLIBLES,
|
||||
correctness,
|
||||
"for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`"
|
||||
}
|
||||
@ -426,7 +426,7 @@ declare_lint_pass!(Loops => [
|
||||
EXPLICIT_ITER_LOOP,
|
||||
EXPLICIT_INTO_ITER_LOOP,
|
||||
ITER_NEXT_LOOP,
|
||||
FOR_LOOP_OVER_FALLIBLE,
|
||||
FOR_LOOPS_OVER_FALLIBLES,
|
||||
WHILE_LET_LOOP,
|
||||
NEEDLESS_COLLECT,
|
||||
EXPLICIT_COUNTER_LOOP,
|
||||
@ -1290,7 +1290,7 @@ fn check_arg_type(cx: &LateContext<'_, '_>, pat: &Pat<'_>, arg: &Expr<'_>) {
|
||||
if is_type_diagnostic_item(cx, ty, sym!(option_type)) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
FOR_LOOP_OVER_FALLIBLE,
|
||||
FOR_LOOPS_OVER_FALLIBLES,
|
||||
arg.span,
|
||||
&format!(
|
||||
"for loop over `{0}`, which is an `Option`. This is more readably written as an \
|
||||
@ -1307,7 +1307,7 @@ fn check_arg_type(cx: &LateContext<'_, '_>, pat: &Pat<'_>, arg: &Expr<'_>) {
|
||||
} else if is_type_diagnostic_item(cx, ty, sym!(result_type)) {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
FOR_LOOP_OVER_FALLIBLE,
|
||||
FOR_LOOPS_OVER_FALLIBLES,
|
||||
arg.span,
|
||||
&format!(
|
||||
"for loop over `{0}`, which is a `Result`. This is more readably written as an \
|
||||
|
@ -74,11 +74,11 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
|
||||
module: "blacklisted_name",
|
||||
},
|
||||
Lint {
|
||||
name: "block_in_if_condition",
|
||||
name: "blocks_in_if_conditions",
|
||||
group: "style",
|
||||
desc: "useless or complex blocks that can be eliminated in conditions",
|
||||
deprecation: None,
|
||||
module: "block_in_if_condition",
|
||||
module: "blocks_in_if_conditions",
|
||||
},
|
||||
Lint {
|
||||
name: "bool_comparison",
|
||||
@ -676,7 +676,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
|
||||
module: "loops",
|
||||
},
|
||||
Lint {
|
||||
name: "for_loop_over_fallible",
|
||||
name: "for_loops_over_fallibles",
|
||||
group: "correctness",
|
||||
desc: "for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`",
|
||||
deprecation: None,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::block_in_if_condition)]
|
||||
#![warn(clippy::blocks_in_if_conditions)]
|
||||
#![allow(unused, clippy::let_and_return)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// run-rustfix
|
||||
#![warn(clippy::block_in_if_condition)]
|
||||
#![warn(clippy::blocks_in_if_conditions)]
|
||||
#![allow(unused, clippy::let_and_return)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
|
||||
--> $DIR/block_in_if_condition.rs:26:5
|
||||
--> $DIR/blocks_in_if_conditions.rs:26:5
|
||||
|
|
||||
LL | / if {
|
||||
LL | | let x = 3;
|
||||
@ -7,7 +7,7 @@ LL | | x == 3
|
||||
LL | | } {
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::block-in-if-condition` implied by `-D warnings`
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
help: try
|
||||
|
|
||||
LL | let res = {
|
||||
@ -17,13 +17,13 @@ LL | }; if res {
|
||||
|
|
||||
|
||||
error: omit braces around single expression condition
|
||||
--> $DIR/block_in_if_condition.rs:37:8
|
||||
--> $DIR/blocks_in_if_conditions.rs:37:8
|
||||
|
|
||||
LL | if { true } {
|
||||
| ^^^^^^^^ help: try: `true`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/block_in_if_condition.rs:46:8
|
||||
--> $DIR/blocks_in_if_conditions.rs:46:8
|
||||
|
|
||||
LL | if true && x == 3 {
|
||||
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
@ -1,4 +1,4 @@
|
||||
#![warn(clippy::block_in_if_condition)]
|
||||
#![warn(clippy::blocks_in_if_conditions)]
|
||||
#![allow(unused, clippy::let_and_return)]
|
||||
|
||||
fn predicate<F: FnOnce(T) -> bool, T>(pfn: F, val: T) -> bool {
|
@ -1,5 +1,5 @@
|
||||
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
|
||||
--> $DIR/block_in_if_condition_closure.rs:18:17
|
||||
--> $DIR/blocks_in_if_conditions_closure.rs:18:17
|
||||
|
|
||||
LL | |x| {
|
||||
| _________________^
|
||||
@ -8,10 +8,10 @@ LL | | x == target
|
||||
LL | | },
|
||||
| |_____________^
|
||||
|
|
||||
= note: `-D clippy::block-in-if-condition` implied by `-D warnings`
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
|
||||
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
|
||||
--> $DIR/block_in_if_condition_closure.rs:27:13
|
||||
--> $DIR/blocks_in_if_conditions_closure.rs:27:13
|
||||
|
|
||||
LL | |x| {
|
||||
| _____________^
|
@ -1,6 +1,6 @@
|
||||
#![warn(clippy::for_loop_over_fallible)]
|
||||
#![warn(clippy::for_loops_over_fallibles)]
|
||||
|
||||
fn for_loop_over_fallible() {
|
||||
fn for_loops_over_fallibles() {
|
||||
let option = Some(1);
|
||||
let result = option.ok_or("x not found");
|
||||
let v = vec![0, 1, 2];
|
@ -1,14 +1,14 @@
|
||||
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_fallible.rs:9:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:9:14
|
||||
|
|
||||
LL | for x in option {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::for-loop-over-fallible` implied by `-D warnings`
|
||||
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
|
||||
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
||||
|
||||
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_fallible.rs:14:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:14:14
|
||||
|
|
||||
LL | for x in result {
|
||||
| ^^^^^^
|
||||
@ -16,7 +16,7 @@ LL | for x in result {
|
||||
= help: consider replacing `for x in result` with `if let Ok(x) = result`
|
||||
|
||||
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_fallible.rs:18:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:18:14
|
||||
|
|
||||
LL | for x in option.ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -24,7 +24,7 @@ LL | for x in option.ok_or("x not found") {
|
||||
= help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
|
||||
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loop_over_fallible.rs:24:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:24:14
|
||||
|
|
||||
LL | for x in v.iter().next() {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
@ -32,7 +32,7 @@ LL | for x in v.iter().next() {
|
||||
= note: `#[deny(clippy::iter_next_loop)]` on by default
|
||||
|
||||
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_fallible.rs:29:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:29:14
|
||||
|
|
||||
LL | for x in v.iter().next().and(Some(0)) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -40,7 +40,7 @@ LL | for x in v.iter().next().and(Some(0)) {
|
||||
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
|
||||
|
||||
error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_fallible.rs:33:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:33:14
|
||||
|
|
||||
LL | for x in v.iter().next().ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -48,7 +48,7 @@ LL | for x in v.iter().next().ok_or("x not found") {
|
||||
= help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/for_loop_over_fallible.rs:45:5
|
||||
--> $DIR/for_loops_over_fallibles.rs:45:5
|
||||
|
|
||||
LL | / while let Some(x) = option {
|
||||
LL | | println!("{}", x);
|
||||
@ -59,7 +59,7 @@ LL | | }
|
||||
= note: `#[deny(clippy::never_loop)]` on by default
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/for_loop_over_fallible.rs:51:5
|
||||
--> $DIR/for_loops_over_fallibles.rs:51:5
|
||||
|
|
||||
LL | / while let Ok(x) = result {
|
||||
LL | | println!("{}", x);
|
Loading…
x
Reference in New Issue
Block a user