Open
Description
The trivial_regex
lint does not seem to make any difference between regex::Regex
and regex::bytes::Regex
when giving hints. I am not sure what should be used for non-anchored regexes, maybe the memchr crate, for anchored it should suggest slice::starts_with
and slice::ends_with
.
warning: trivial regex
--> src/bin/foo.rs:2:30
|
2 | regex::bytes::Regex::new("foo").unwrap();
| ^^^^^
|
= note: #[warn(clippy::trivial_regex)] on by default
= help: consider using `str::contains`
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#trivial_regex
warning: trivial regex
--> src/bin/foo.rs:3:30
|
3 | regex::bytes::Regex::new("^bar").unwrap();
| ^^^^^^
|
= help: consider using `str::starts_with`
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#trivial_regex
Version: clippy 0.0.212 (2e26fdc 2018-11-22)
Metadata
Metadata
Assignees
Labels
No labels