mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
49 lines
1.6 KiB
Rust
49 lines
1.6 KiB
Rust
//@aux-build:proc_macros.rs
|
|
#![allow(clippy::eq_op, clippy::needless_raw_string_hashes, clippy::no_effect, unused)]
|
|
#![warn(clippy::string_lit_chars_any)]
|
|
|
|
#[macro_use]
|
|
extern crate proc_macros;
|
|
|
|
struct NotStringLit;
|
|
|
|
impl NotStringLit {
|
|
fn chars(&self) -> impl Iterator<Item = char> {
|
|
"c".chars()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let c = 'c';
|
|
matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
#[rustfmt::skip]
|
|
matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
// Do not lint
|
|
NotStringLit.chars().any(|x| x == c);
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|x| {
|
|
let c = 'c';
|
|
x == c
|
|
});
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|x| {
|
|
1;
|
|
x == c
|
|
});
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|x| x == x);
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|_x| c == c);
|
|
matches!(
|
|
c,
|
|
'\\' | '.' | '+' | '*' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'
|
|
);
|
|
external! {
|
|
let c = 'c';
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
|
|
}
|
|
with_span! {
|
|
span
|
|
let c = 'c';
|
|
"\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
|
|
}
|
|
}
|