Skip to content

Commit 0fcad09

Browse files
Move code comments to prevent having weird clippy fmt issues
1 parent 3eb276a commit 0fcad09

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

tests/ui/const_comparisons.rs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ fn main() {
4040
let status_code = 500; // Value doesn't matter for the lint
4141
let status = Status { code: status_code };
4242

43-
status_code >= 400 && status_code < 500; // Correct
43+
// Correct
44+
status_code >= 400 && status_code < 500;
4445
status_code <= 400 && status_code > 500;
4546
//~^ ERROR: boolean expression will never evaluate to 'true'
4647
//~| NOTE: since `400` < `500`, the expression evaluates to false for any value of `st
@@ -80,22 +81,30 @@ fn main() {
8081
//~| NOTE: `status` cannot simultaneously be greater than and less than `STATUS_SERVER
8182

8283
// Yoda conditions
83-
500 <= status_code && 600 > status_code; // Correct
84-
500 <= status_code && status_code <= 600; // Correct
85-
500 >= status_code && 600 < status_code; // Incorrect
84+
// Correct
85+
500 <= status_code && 600 > status_code;
86+
// Correct
87+
500 <= status_code && status_code <= 600;
88+
// Incorrect
89+
500 >= status_code && 600 < status_code;
8690
//~^ ERROR: boolean expression will never evaluate to 'true'
8791
//~| NOTE: since `500` < `600`, the expression evaluates to false for any value of `st
88-
500 >= status_code && status_code > 600; // Incorrect
92+
// Incorrect
93+
500 >= status_code && status_code > 600;
8994
//~^ ERROR: boolean expression will never evaluate to 'true'
9095
//~| NOTE: since `500` < `600`, the expression evaluates to false for any value of `st
9196

9297
// Yoda conditions, comparing two different types
93-
500 <= status && 600 > status; // Correct
94-
500 <= status && status <= 600; // Correct
95-
500 >= status && 600 < status; // Incorrect
98+
// Correct
99+
500 <= status && 600 > status;
100+
// Correct
101+
500 <= status && status <= 600;
102+
// Incorrect
103+
500 >= status && 600 < status;
96104
//~^ ERROR: boolean expression will never evaluate to 'true'
97105
//~| NOTE: since `500` < `600`, the expression evaluates to false for any value of `st
98-
500 >= status && status > 600; // Incorrect
106+
// Incorrect
107+
500 >= status && status > 600;
99108
//~^ ERROR: boolean expression will never evaluate to 'true'
100109
//~| NOTE: since `500` < `600`, the expression evaluates to false for any value of `st
101110

@@ -105,13 +114,17 @@ fn main() {
105114
status_code > 200 && status_code >= 299;
106115
//~^ ERROR: left-hand side of `&&` operator has no effect
107116

108-
status_code >= 500 && status_code > 500; // Useless left
117+
// Useless left
118+
status_code >= 500 && status_code > 500;
109119
//~^ ERROR: left-hand side of `&&` operator has no effect
110-
status_code > 500 && status_code >= 500; // Useless right
120+
// Useless right
121+
status_code > 500 && status_code >= 500;
111122
//~^ ERROR: right-hand side of `&&` operator has no effect
112-
status_code <= 500 && status_code < 500; // Useless left
123+
// Useless left
124+
status_code <= 500 && status_code < 500;
113125
//~^ ERROR: left-hand side of `&&` operator has no effect
114-
status_code < 500 && status_code <= 500; // Useless right
126+
// Useless right
127+
status_code < 500 && status_code <= 500;
115128
//~^ ERROR: right-hand side of `&&` operator has no effect
116129

117130
// Other types

0 commit comments

Comments
 (0)