remove assert macro
This commit is contained in:
parent
949d0709bd
commit
1f862c2ad3
@ -25,13 +25,9 @@ declare_clippy_lint! {
|
||||
/// assert!(matches!('2', '0'..='9'));
|
||||
/// assert!(matches!('x', 'A'..='Z' | 'a'..='z'));
|
||||
///
|
||||
/// assert!((b'0'..=b'9').contains(&b'0'));
|
||||
/// assert!((b'a'..=b'z').contains(&b'a'));
|
||||
/// assert!((b'A'..=b'Z').contains(&b'A'));
|
||||
///
|
||||
/// assert!(('0'..='9').contains(&'0'));
|
||||
/// assert!(('a'..='z').contains(&'a'));
|
||||
/// assert!(('A'..='Z').contains(&'A'));
|
||||
/// ('0'..='9').contains(&'0');
|
||||
/// ('a'..='z').contains(&'a');
|
||||
/// ('A'..='Z').contains(&'A');
|
||||
/// }
|
||||
/// ```
|
||||
/// Use instead:
|
||||
@ -42,13 +38,9 @@ declare_clippy_lint! {
|
||||
/// assert!('2'.is_ascii_digit());
|
||||
/// assert!('x'.is_ascii_alphabetic());
|
||||
///
|
||||
/// assert!(b'0'.is_ascii_digit());
|
||||
/// assert!(b'a'.is_ascii_lowercase());
|
||||
/// assert!(b'A'.is_ascii_uppercase());
|
||||
///
|
||||
/// assert!('0'.is_ascii_digit());
|
||||
/// assert!('a'.is_ascii_lowercase());
|
||||
/// assert!('A'.is_ascii_uppercase());
|
||||
/// '0'.is_ascii_digit();
|
||||
/// 'a'.is_ascii_lowercase();
|
||||
/// 'A'.is_ascii_uppercase();
|
||||
/// }
|
||||
/// ```
|
||||
#[clippy::version = "1.66.0"]
|
||||
|
@ -16,13 +16,18 @@ fn main() {
|
||||
|
||||
assert!(matches!('x', 'A'..='Z' | 'a'..='z' | '_'));
|
||||
|
||||
assert!(b'0'.is_ascii_digit());
|
||||
assert!(b'a'.is_ascii_lowercase());
|
||||
assert!(b'A'.is_ascii_uppercase());
|
||||
b'0'.is_ascii_digit();
|
||||
b'a'.is_ascii_lowercase();
|
||||
b'A'.is_ascii_uppercase();
|
||||
|
||||
assert!('0'.is_ascii_digit());
|
||||
assert!('a'.is_ascii_lowercase());
|
||||
assert!('A'.is_ascii_uppercase());
|
||||
'0'.is_ascii_digit();
|
||||
'a'.is_ascii_lowercase();
|
||||
'A'.is_ascii_uppercase();
|
||||
|
||||
let cool_letter = &'g';
|
||||
cool_letter.is_ascii_digit();
|
||||
cool_letter.is_ascii_lowercase();
|
||||
cool_letter.is_ascii_uppercase();
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.23"]
|
||||
|
@ -16,13 +16,18 @@ fn main() {
|
||||
|
||||
assert!(matches!('x', 'A'..='Z' | 'a'..='z' | '_'));
|
||||
|
||||
assert!((b'0'..=b'9').contains(&b'0'));
|
||||
assert!((b'a'..=b'z').contains(&b'a'));
|
||||
assert!((b'A'..=b'Z').contains(&b'A'));
|
||||
(b'0'..=b'9').contains(&b'0');
|
||||
(b'a'..=b'z').contains(&b'a');
|
||||
(b'A'..=b'Z').contains(&b'A');
|
||||
|
||||
assert!(('0'..='9').contains(&'0'));
|
||||
assert!(('a'..='z').contains(&'a'));
|
||||
assert!(('A'..='Z').contains(&'A'));
|
||||
('0'..='9').contains(&'0');
|
||||
('a'..='z').contains(&'a');
|
||||
('A'..='Z').contains(&'A');
|
||||
|
||||
let cool_letter = &'g';
|
||||
('0'..='9').contains(cool_letter);
|
||||
('a'..='z').contains(cool_letter);
|
||||
('A'..='Z').contains(cool_letter);
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.23"]
|
||||
|
@ -43,64 +43,82 @@ LL | assert!(matches!('x', 'A'..='Z' | 'a'..='z'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_alphabetic()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:19:13
|
||||
--> $DIR/manual_is_ascii_check.rs:19:5
|
||||
|
|
||||
LL | assert!((b'0'..=b'9').contains(&b'0'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'0'.is_ascii_digit()`
|
||||
LL | (b'0'..=b'9').contains(&b'0');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'0'.is_ascii_digit()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:20:13
|
||||
--> $DIR/manual_is_ascii_check.rs:20:5
|
||||
|
|
||||
LL | assert!((b'a'..=b'z').contains(&b'a'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'a'.is_ascii_lowercase()`
|
||||
LL | (b'a'..=b'z').contains(&b'a');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'a'.is_ascii_lowercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:21:13
|
||||
--> $DIR/manual_is_ascii_check.rs:21:5
|
||||
|
|
||||
LL | assert!((b'A'..=b'Z').contains(&b'A'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'A'.is_ascii_uppercase()`
|
||||
LL | (b'A'..=b'Z').contains(&b'A');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'A'.is_ascii_uppercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:23:13
|
||||
--> $DIR/manual_is_ascii_check.rs:23:5
|
||||
|
|
||||
LL | assert!(('0'..='9').contains(&'0'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'0'.is_ascii_digit()`
|
||||
LL | ('0'..='9').contains(&'0');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'0'.is_ascii_digit()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:24:13
|
||||
--> $DIR/manual_is_ascii_check.rs:24:5
|
||||
|
|
||||
LL | assert!(('a'..='z').contains(&'a'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'a'.is_ascii_lowercase()`
|
||||
LL | ('a'..='z').contains(&'a');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'a'.is_ascii_lowercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:25:13
|
||||
--> $DIR/manual_is_ascii_check.rs:25:5
|
||||
|
|
||||
LL | assert!(('A'..='Z').contains(&'A'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'A'.is_ascii_uppercase()`
|
||||
LL | ('A'..='Z').contains(&'A');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'A'.is_ascii_uppercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:37:13
|
||||
--> $DIR/manual_is_ascii_check.rs:28:5
|
||||
|
|
||||
LL | ('0'..='9').contains(cool_letter);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_digit()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:29:5
|
||||
|
|
||||
LL | ('a'..='z').contains(cool_letter);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_lowercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:30:5
|
||||
|
|
||||
LL | ('A'..='Z').contains(cool_letter);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cool_letter.is_ascii_uppercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:42:13
|
||||
|
|
||||
LL | assert!(matches!(b'1', b'0'..=b'9'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b'1'.is_ascii_digit()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:38:13
|
||||
--> $DIR/manual_is_ascii_check.rs:43:13
|
||||
|
|
||||
LL | assert!(matches!('X', 'A'..='Z'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'X'.is_ascii_uppercase()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:39:13
|
||||
--> $DIR/manual_is_ascii_check.rs:44:13
|
||||
|
|
||||
LL | assert!(matches!('x', 'A'..='Z' | 'a'..='z'));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_alphabetic()`
|
||||
|
||||
error: manual check for common ascii range
|
||||
--> $DIR/manual_is_ascii_check.rs:49:23
|
||||
--> $DIR/manual_is_ascii_check.rs:54:23
|
||||
|
|
||||
LL | const FOO: bool = matches!('x', '0'..='9');
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `'x'.is_ascii_digit()`
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
error: aborting due to 20 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user