Add manual_ignore_cast_cmp lint
This commit is contained in:
parent
db1bda3df1
commit
d1dec199ee
7 changed files with 891 additions and 0 deletions
107
tests/ui/manual_ignore_case_cmp.fixed
Normal file
107
tests/ui/manual_ignore_case_cmp.fixed
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#![allow(clippy::all)]
|
||||
#![deny(clippy::manual_ignore_case_cmp)]
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn variants(a: &str, b: &str) {
|
||||
if a.eq_ignore_ascii_case(b) {
|
||||
return;
|
||||
}
|
||||
if a.eq_ignore_ascii_case(b) {
|
||||
return;
|
||||
}
|
||||
let r = a.eq_ignore_ascii_case(b);
|
||||
let r = r || a.eq_ignore_ascii_case(b);
|
||||
r && a.eq_ignore_ascii_case(&b.to_uppercase());
|
||||
// !=
|
||||
if !a.eq_ignore_ascii_case(b) {
|
||||
return;
|
||||
}
|
||||
if !a.eq_ignore_ascii_case(b) {
|
||||
return;
|
||||
}
|
||||
let r = !a.eq_ignore_ascii_case(b);
|
||||
let r = r || !a.eq_ignore_ascii_case(b);
|
||||
r && !a.eq_ignore_ascii_case(&b.to_uppercase());
|
||||
}
|
||||
|
||||
fn unsupported(a: char, b: char) {
|
||||
// TODO:: these are rare, and might not be worth supporting
|
||||
a.to_ascii_lowercase() == char::to_ascii_lowercase(&b);
|
||||
char::to_ascii_lowercase(&a) == b.to_ascii_lowercase();
|
||||
char::to_ascii_lowercase(&a) == char::to_ascii_lowercase(&b);
|
||||
}
|
||||
|
||||
fn char(a: char, b: char) {
|
||||
a.eq_ignore_ascii_case(&b);
|
||||
a.to_ascii_lowercase() == *&b.to_ascii_lowercase();
|
||||
*&a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.eq_ignore_ascii_case(&'a');
|
||||
'a'.eq_ignore_ascii_case(&b);
|
||||
}
|
||||
fn u8(a: u8, b: u8) {
|
||||
a.eq_ignore_ascii_case(&b);
|
||||
a.eq_ignore_ascii_case(&b'a');
|
||||
b'a'.eq_ignore_ascii_case(&b);
|
||||
}
|
||||
fn ref_str(a: &str, b: &str) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
a.to_uppercase().eq_ignore_ascii_case(b);
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(b);
|
||||
}
|
||||
fn ref_ref_str(a: &&str, b: &&str) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
a.to_uppercase().eq_ignore_ascii_case(b);
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(b);
|
||||
}
|
||||
fn string(a: String, b: String) {
|
||||
a.eq_ignore_ascii_case(&b);
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(&b);
|
||||
&a.to_ascii_lowercase() == &b.to_ascii_lowercase();
|
||||
&&a.to_ascii_lowercase() == &&b.to_ascii_lowercase();
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(&b);
|
||||
}
|
||||
fn ref_string(a: String, b: &String) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(b);
|
||||
|
||||
b.eq_ignore_ascii_case(&a);
|
||||
b.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(&a);
|
||||
}
|
||||
fn string_ref_str(a: String, b: &str) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
a.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(b);
|
||||
|
||||
b.eq_ignore_ascii_case(&a);
|
||||
b.eq_ignore_ascii_case("a");
|
||||
"a".eq_ignore_ascii_case(&a);
|
||||
}
|
||||
fn ref_u8slice(a: &[u8], b: &[u8]) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
}
|
||||
fn u8vec(a: Vec<u8>, b: Vec<u8>) {
|
||||
a.eq_ignore_ascii_case(&b);
|
||||
}
|
||||
fn ref_u8vec(a: Vec<u8>, b: &Vec<u8>) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
b.eq_ignore_ascii_case(&a);
|
||||
}
|
||||
fn ref_osstr(a: &OsStr, b: &OsStr) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
}
|
||||
fn osstring(a: OsString, b: OsString) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
}
|
||||
fn ref_osstring(a: OsString, b: &OsString) {
|
||||
a.eq_ignore_ascii_case(b);
|
||||
b.eq_ignore_ascii_case(a);
|
||||
}
|
||||
107
tests/ui/manual_ignore_case_cmp.rs
Normal file
107
tests/ui/manual_ignore_case_cmp.rs
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#![allow(clippy::all)]
|
||||
#![deny(clippy::manual_ignore_case_cmp)]
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn variants(a: &str, b: &str) {
|
||||
if a.to_ascii_lowercase() == b.to_ascii_lowercase() {
|
||||
return;
|
||||
}
|
||||
if a.to_ascii_uppercase() == b.to_ascii_uppercase() {
|
||||
return;
|
||||
}
|
||||
let r = a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
let r = r || a.to_ascii_uppercase() == b.to_ascii_uppercase();
|
||||
r && a.to_ascii_lowercase() == b.to_uppercase().to_ascii_lowercase();
|
||||
// !=
|
||||
if a.to_ascii_lowercase() != b.to_ascii_lowercase() {
|
||||
return;
|
||||
}
|
||||
if a.to_ascii_uppercase() != b.to_ascii_uppercase() {
|
||||
return;
|
||||
}
|
||||
let r = a.to_ascii_lowercase() != b.to_ascii_lowercase();
|
||||
let r = r || a.to_ascii_uppercase() != b.to_ascii_uppercase();
|
||||
r && a.to_ascii_lowercase() != b.to_uppercase().to_ascii_lowercase();
|
||||
}
|
||||
|
||||
fn unsupported(a: char, b: char) {
|
||||
// TODO:: these are rare, and might not be worth supporting
|
||||
a.to_ascii_lowercase() == char::to_ascii_lowercase(&b);
|
||||
char::to_ascii_lowercase(&a) == b.to_ascii_lowercase();
|
||||
char::to_ascii_lowercase(&a) == char::to_ascii_lowercase(&b);
|
||||
}
|
||||
|
||||
fn char(a: char, b: char) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == *&b.to_ascii_lowercase();
|
||||
*&a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == 'a';
|
||||
'a' == b.to_ascii_lowercase();
|
||||
}
|
||||
fn u8(a: u8, b: u8) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == b'a';
|
||||
b'a' == b.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_str(a: &str, b: &str) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_ref_str(a: &&str, b: &&str) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
}
|
||||
fn string(a: String, b: String) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
&a.to_ascii_lowercase() == &b.to_ascii_lowercase();
|
||||
&&a.to_ascii_lowercase() == &&b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_string(a: String, b: &String) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
|
||||
b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
b.to_ascii_lowercase() == "a";
|
||||
"a" == a.to_ascii_lowercase();
|
||||
}
|
||||
fn string_ref_str(a: String, b: &str) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
a.to_ascii_lowercase() == "a";
|
||||
"a" == b.to_ascii_lowercase();
|
||||
|
||||
b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
b.to_ascii_lowercase() == "a";
|
||||
"a" == a.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_u8slice(a: &[u8], b: &[u8]) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
}
|
||||
fn u8vec(a: Vec<u8>, b: Vec<u8>) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_u8vec(a: Vec<u8>, b: &Vec<u8>) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_osstr(a: &OsStr, b: &OsStr) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
}
|
||||
fn osstring(a: OsString, b: OsString) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
}
|
||||
fn ref_osstring(a: OsString, b: &OsString) {
|
||||
a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
}
|
||||
546
tests/ui/manual_ignore_case_cmp.stderr
Normal file
546
tests/ui/manual_ignore_case_cmp.stderr
Normal file
|
|
@ -0,0 +1,546 @@
|
|||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:9:8
|
||||
|
|
||||
LL | if a.to_ascii_lowercase() == b.to_ascii_lowercase() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::manual_ignore_case_cmp)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | if a.eq_ignore_ascii_case(b) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:12:8
|
||||
|
|
||||
LL | if a.to_ascii_uppercase() == b.to_ascii_uppercase() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | if a.eq_ignore_ascii_case(b) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:15:13
|
||||
|
|
||||
LL | let r = a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | let r = a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:16:18
|
||||
|
|
||||
LL | let r = r || a.to_ascii_uppercase() == b.to_ascii_uppercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | let r = r || a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:17:10
|
||||
|
|
||||
LL | r && a.to_ascii_lowercase() == b.to_uppercase().to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | r && a.eq_ignore_ascii_case(&b.to_uppercase());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:19:8
|
||||
|
|
||||
LL | if a.to_ascii_lowercase() != b.to_ascii_lowercase() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | if !a.eq_ignore_ascii_case(b) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:22:8
|
||||
|
|
||||
LL | if a.to_ascii_uppercase() != b.to_ascii_uppercase() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | if !a.eq_ignore_ascii_case(b) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:25:13
|
||||
|
|
||||
LL | let r = a.to_ascii_lowercase() != b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | let r = !a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:26:18
|
||||
|
|
||||
LL | let r = r || a.to_ascii_uppercase() != b.to_ascii_uppercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | let r = r || !a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:27:10
|
||||
|
|
||||
LL | r && a.to_ascii_lowercase() != b.to_uppercase().to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | r && !a.eq_ignore_ascii_case(&b.to_uppercase());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:38:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:41:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == 'a';
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&'a');
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:42:5
|
||||
|
|
||||
LL | 'a' == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | 'a'.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:45:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:46:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b'a';
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&b'a');
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:47:5
|
||||
|
|
||||
LL | b'a' == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b'a'.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:50:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:51:5
|
||||
|
|
||||
LL | a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.to_uppercase().eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:52:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:53:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:56:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:57:5
|
||||
|
|
||||
LL | a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.to_uppercase().eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:58:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:59:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:62:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:63:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:64:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:67:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:68:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:71:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:72:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:73:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:75:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case(&a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:76:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:77:5
|
||||
|
|
||||
LL | "a" == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(&a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:80:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:81:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:82:5
|
||||
|
|
||||
LL | "a" == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:84:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case(&a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:85:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == "a";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case("a");
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:86:5
|
||||
|
|
||||
LL | "a" == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | "a".eq_ignore_ascii_case(&a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:89:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:92:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(&b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:95:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:96:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case(&a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:99:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:102:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:105:5
|
||||
|
|
||||
LL | a.to_ascii_lowercase() == b.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | a.eq_ignore_ascii_case(b);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: manual case-insensitive ASCII comparison
|
||||
--> tests/ui/manual_ignore_case_cmp.rs:106:5
|
||||
|
|
||||
LL | b.to_ascii_lowercase() == a.to_ascii_lowercase();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider using `.eq_ignore_ascii_case()` instead
|
||||
|
|
||||
LL | b.eq_ignore_ascii_case(a);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 49 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue