Skip to content

Commit 8f39061

Browse files
committed
Auto merge of #9306 - guerinoni:rename-logic-bug, r=llogiq,xFrednet
Rename `logic_bug` to `overly_complex_bool_expr` Closes #1916 changelog: Rename `logic_bug` to [`overly_complex_bool_expr`]
2 parents 4912c0e + f6cab94 commit 8f39061

14 files changed

+85
-73
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,6 +3818,7 @@ Released 2018-09-13
38183818
[`or_then_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#or_then_unwrap
38193819
[`out_of_bounds_indexing`]: https://rust-lang.github.io/rust-clippy/master/index.html#out_of_bounds_indexing
38203820
[`overflow_check_conditional`]: https://rust-lang.github.io/rust-clippy/master/index.html#overflow_check_conditional
3821+
[`overly_complex_bool_expr`]: https://rust-lang.github.io/rust-clippy/master/index.html#overly_complex_bool_expr
38213822
[`panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic
38223823
[`panic_in_result_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn
38233824
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params

clippy_lints/src/booleans.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ declare_clippy_lint! {
6464
/// if a {}
6565
/// ```
6666
#[clippy::version = "pre 1.29.0"]
67-
pub LOGIC_BUG,
67+
pub OVERLY_COMPLEX_BOOL_EXPR,
6868
correctness,
6969
"boolean expressions that contain terminals which can be eliminated"
7070
}
7171

7272
// For each pairs, both orders are considered.
7373
const METHODS_WITH_NEGATION: [(&str, &str); 2] = [("is_some", "is_none"), ("is_err", "is_ok")];
7474

75-
declare_lint_pass!(NonminimalBool => [NONMINIMAL_BOOL, LOGIC_BUG]);
75+
declare_lint_pass!(NonminimalBool => [NONMINIMAL_BOOL, OVERLY_COMPLEX_BOOL_EXPR]);
7676

7777
impl<'tcx> LateLintPass<'tcx> for NonminimalBool {
7878
fn check_fn(
@@ -396,7 +396,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
396396
if stats.terminals[i] != 0 && simplified_stats.terminals[i] == 0 {
397397
span_lint_hir_and_then(
398398
self.cx,
399-
LOGIC_BUG,
399+
OVERLY_COMPLEX_BOOL_EXPR,
400400
e.hir_id,
401401
e.span,
402402
"this boolean expression contains a logic bug",

clippy_lints/src/lib.register_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
1717
LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF),
1818
LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
1919
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
20-
LintId::of(booleans::LOGIC_BUG),
2120
LintId::of(booleans::NONMINIMAL_BOOL),
21+
LintId::of(booleans::OVERLY_COMPLEX_BOOL_EXPR),
2222
LintId::of(borrow_deref_ref::BORROW_DEREF_REF),
2323
LintId::of(bytes_count_to_len::BYTES_COUNT_TO_LEN),
2424
LintId::of(casts::CAST_ABS_TO_UNSIGNED),

clippy_lints/src/lib.register_correctness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ store.register_group(true, "clippy::correctness", Some("clippy_correctness"), ve
88
LintId::of(attrs::DEPRECATED_SEMVER),
99
LintId::of(attrs::MISMATCHED_TARGET_OS),
1010
LintId::of(attrs::USELESS_ATTRIBUTE),
11-
LintId::of(booleans::LOGIC_BUG),
11+
LintId::of(booleans::OVERLY_COMPLEX_BOOL_EXPR),
1212
LintId::of(casts::CAST_REF_TO_MUT),
1313
LintId::of(casts::CAST_SLICE_DIFFERENT_SIZES),
1414
LintId::of(copies::IFS_SAME_COND),

clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ store.register_lints(&[
5757
await_holding_invalid::AWAIT_HOLDING_REFCELL_REF,
5858
blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
5959
bool_assert_comparison::BOOL_ASSERT_COMPARISON,
60-
booleans::LOGIC_BUG,
6160
booleans::NONMINIMAL_BOOL,
61+
booleans::OVERLY_COMPLEX_BOOL_EXPR,
6262
borrow_as_ptr::BORROW_AS_PTR,
6363
borrow_deref_ref::BORROW_DEREF_REF,
6464
bytecount::NAIVE_BYTECOUNT,

clippy_lints/src/renamed_lints.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
#[rustfmt::skip]
44
pub static RENAMED_LINTS: &[(&str, &str)] = &[
5+
("clippy::blacklisted_name", "clippy::disallowed_names"),
56
("clippy::block_in_if_condition_expr", "clippy::blocks_in_if_conditions"),
67
("clippy::block_in_if_condition_stmt", "clippy::blocks_in_if_conditions"),
78
("clippy::box_vec", "clippy::box_collection"),
8-
("clippy::blacklisted_name", "clippy::disallowed_names"),
99
("clippy::const_static_lifetime", "clippy::redundant_static_lifetimes"),
1010
("clippy::cyclomatic_complexity", "clippy::cognitive_complexity"),
1111
("clippy::disallowed_method", "clippy::disallowed_methods"),
@@ -15,6 +15,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
1515
("clippy::for_loop_over_result", "clippy::for_loops_over_fallibles"),
1616
("clippy::identity_conversion", "clippy::useless_conversion"),
1717
("clippy::if_let_some_result", "clippy::match_result_ok"),
18+
("clippy::logic_bug", "clippy::overly_complex_bool_expr"),
1819
("clippy::new_without_default_derive", "clippy::new_without_default"),
1920
("clippy::option_and_then_some", "clippy::bind_instead_of_map"),
2021
("clippy::option_expect_used", "clippy::expect_used"),

tests/ui/diverging_sub_expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::diverging_sub_expression)]
2-
#![allow(clippy::match_same_arms, clippy::logic_bug)]
2+
#![allow(clippy::match_same_arms, clippy::overly_complex_bool_expr)]
33
#[allow(clippy::empty_loop)]
44
fn diverge() -> ! {
55
loop {}

tests/ui/expect_tool_lint_rfc_2383.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod clippy_ok {
9898
let _ = if true { 42 } else { 42 };
9999
}
100100

101-
#[expect(clippy::logic_bug)]
101+
#[expect(clippy::overly_complex_bool_expr)]
102102
fn burger() {
103103
let a = false;
104104
let b = true;
@@ -127,7 +127,7 @@ mod clippy_warn {
127127
let _ = if true { 33 } else { 42 };
128128
}
129129

130-
#[expect(clippy::logic_bug)]
130+
#[expect(clippy::overly_complex_bool_expr)]
131131
fn burger() {
132132
let a = false;
133133
let b = true;

tests/ui/expect_tool_lint_rfc_2383.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ LL | #[expect(clippy::if_same_then_else)]
3333
error: this lint expectation is unfulfilled
3434
--> $DIR/expect_tool_lint_rfc_2383.rs:130:14
3535
|
36-
LL | #[expect(clippy::logic_bug)]
37-
| ^^^^^^^^^^^^^^^^^
36+
LL | #[expect(clippy::overly_complex_bool_expr)]
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

3939
error: aborting due to 6 previous errors
4040

tests/ui/logic_bug.rs renamed to tests/ui/overly_complex_bool_expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(lint_reasons)]
22
#![allow(unused, clippy::diverging_sub_expression)]
3-
#![warn(clippy::logic_bug)]
3+
#![warn(clippy::overly_complex_bool_expr)]
44

55
fn main() {
66
let a: bool = unimplemented!();
@@ -29,6 +29,6 @@ fn equality_stuff() {
2929
fn check_expect() {
3030
let a: i32 = unimplemented!();
3131
let b: i32 = unimplemented!();
32-
#[expect(clippy::logic_bug)]
32+
#[expect(clippy::overly_complex_bool_expr)]
3333
let _ = a < b && a >= b;
3434
}

tests/ui/logic_bug.stderr renamed to tests/ui/overly_complex_bool_expr.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
error: this boolean expression contains a logic bug
2-
--> $DIR/logic_bug.rs:11:13
2+
--> $DIR/overly_complex_bool_expr.rs:11:13
33
|
44
LL | let _ = a && b || a;
55
| ^^^^^^^^^^^ help: it would look like the following: `a`
66
|
7-
= note: `-D clippy::logic-bug` implied by `-D warnings`
7+
= note: `-D clippy::overly-complex-bool-expr` implied by `-D warnings`
88
help: this expression can be optimized out by applying boolean operations to the outer expression
9-
--> $DIR/logic_bug.rs:11:18
9+
--> $DIR/overly_complex_bool_expr.rs:11:18
1010
|
1111
LL | let _ = a && b || a;
1212
| ^
1313

1414
error: this boolean expression contains a logic bug
15-
--> $DIR/logic_bug.rs:13:13
15+
--> $DIR/overly_complex_bool_expr.rs:13:13
1616
|
1717
LL | let _ = false && a;
1818
| ^^^^^^^^^^ help: it would look like the following: `false`
1919
|
2020
help: this expression can be optimized out by applying boolean operations to the outer expression
21-
--> $DIR/logic_bug.rs:13:22
21+
--> $DIR/overly_complex_bool_expr.rs:13:22
2222
|
2323
LL | let _ = false && a;
2424
| ^
2525

2626
error: this boolean expression contains a logic bug
27-
--> $DIR/logic_bug.rs:23:13
27+
--> $DIR/overly_complex_bool_expr.rs:23:13
2828
|
2929
LL | let _ = a == b && a != b;
3030
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
3131
|
3232
help: this expression can be optimized out by applying boolean operations to the outer expression
33-
--> $DIR/logic_bug.rs:23:13
33+
--> $DIR/overly_complex_bool_expr.rs:23:13
3434
|
3535
LL | let _ = a == b && a != b;
3636
| ^^^^^^
3737

3838
error: this boolean expression contains a logic bug
39-
--> $DIR/logic_bug.rs:24:13
39+
--> $DIR/overly_complex_bool_expr.rs:24:13
4040
|
4141
LL | let _ = a < b && a >= b;
4242
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
4343
|
4444
help: this expression can be optimized out by applying boolean operations to the outer expression
45-
--> $DIR/logic_bug.rs:24:13
45+
--> $DIR/overly_complex_bool_expr.rs:24:13
4646
|
4747
LL | let _ = a < b && a >= b;
4848
| ^^^^^
4949

5050
error: this boolean expression contains a logic bug
51-
--> $DIR/logic_bug.rs:25:13
51+
--> $DIR/overly_complex_bool_expr.rs:25:13
5252
|
5353
LL | let _ = a > b && a <= b;
5454
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
5555
|
5656
help: this expression can be optimized out by applying boolean operations to the outer expression
57-
--> $DIR/logic_bug.rs:25:13
57+
--> $DIR/overly_complex_bool_expr.rs:25:13
5858
|
5959
LL | let _ = a > b && a <= b;
6060
| ^^^^^

tests/ui/rename.fixed

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
// run-rustfix
66

7+
#![allow(clippy::disallowed_names)]
78
#![allow(clippy::blocks_in_if_conditions)]
89
#![allow(clippy::box_collection)]
9-
#![allow(clippy::disallowed_names)]
1010
#![allow(clippy::redundant_static_lifetimes)]
1111
#![allow(clippy::cognitive_complexity)]
1212
#![allow(clippy::disallowed_methods)]
@@ -15,6 +15,7 @@
1515
#![allow(clippy::for_loops_over_fallibles)]
1616
#![allow(clippy::useless_conversion)]
1717
#![allow(clippy::match_result_ok)]
18+
#![allow(clippy::overly_complex_bool_expr)]
1819
#![allow(clippy::new_without_default)]
1920
#![allow(clippy::bind_instead_of_map)]
2021
#![allow(clippy::expect_used)]
@@ -34,10 +35,10 @@
3435
#![allow(temporary_cstring_as_ptr)]
3536
#![allow(unknown_lints)]
3637
#![allow(unused_labels)]
38+
#![warn(clippy::disallowed_names)]
3739
#![warn(clippy::blocks_in_if_conditions)]
3840
#![warn(clippy::blocks_in_if_conditions)]
3941
#![warn(clippy::box_collection)]
40-
#![warn(clippy::disallowed_names)]
4142
#![warn(clippy::redundant_static_lifetimes)]
4243
#![warn(clippy::cognitive_complexity)]
4344
#![warn(clippy::disallowed_methods)]
@@ -47,6 +48,7 @@
4748
#![warn(clippy::for_loops_over_fallibles)]
4849
#![warn(clippy::useless_conversion)]
4950
#![warn(clippy::match_result_ok)]
51+
#![warn(clippy::overly_complex_bool_expr)]
5052
#![warn(clippy::new_without_default)]
5153
#![warn(clippy::bind_instead_of_map)]
5254
#![warn(clippy::expect_used)]

tests/ui/rename.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
// run-rustfix
66

7+
#![allow(clippy::disallowed_names)]
78
#![allow(clippy::blocks_in_if_conditions)]
89
#![allow(clippy::box_collection)]
9-
#![allow(clippy::disallowed_names)]
1010
#![allow(clippy::redundant_static_lifetimes)]
1111
#![allow(clippy::cognitive_complexity)]
1212
#![allow(clippy::disallowed_methods)]
@@ -15,6 +15,7 @@
1515
#![allow(clippy::for_loops_over_fallibles)]
1616
#![allow(clippy::useless_conversion)]
1717
#![allow(clippy::match_result_ok)]
18+
#![allow(clippy::overly_complex_bool_expr)]
1819
#![allow(clippy::new_without_default)]
1920
#![allow(clippy::bind_instead_of_map)]
2021
#![allow(clippy::expect_used)]
@@ -34,10 +35,10 @@
3435
#![allow(temporary_cstring_as_ptr)]
3536
#![allow(unknown_lints)]
3637
#![allow(unused_labels)]
38+
#![warn(clippy::blacklisted_name)]
3739
#![warn(clippy::block_in_if_condition_expr)]
3840
#![warn(clippy::block_in_if_condition_stmt)]
3941
#![warn(clippy::box_vec)]
40-
#![warn(clippy::blacklisted_name)]
4142
#![warn(clippy::const_static_lifetime)]
4243
#![warn(clippy::cyclomatic_complexity)]
4344
#![warn(clippy::disallowed_method)]
@@ -47,6 +48,7 @@
4748
#![warn(clippy::for_loop_over_result)]
4849
#![warn(clippy::identity_conversion)]
4950
#![warn(clippy::if_let_some_result)]
51+
#![warn(clippy::logic_bug)]
5052
#![warn(clippy::new_without_default_derive)]
5153
#![warn(clippy::option_and_then_some)]
5254
#![warn(clippy::option_expect_used)]

0 commit comments

Comments
 (0)