rust-clippy/tests/compile-fail/regex.rs

25 lines
580 B
Rust
Raw Normal View History

2016-02-04 23:36:06 +00:00
#![feature(plugin)]
#![plugin(clippy)]
#![allow(unused)]
#![deny(invalid_regex)]
extern crate regex;
use regex::Regex;
2016-02-05 15:48:35 +00:00
const OPENING_PAREN : &'static str = "(";
2016-02-04 23:36:06 +00:00
fn main() {
let pipe_in_wrong_position = Regex::new("|");
2016-02-05 20:54:29 +00:00
//~^ERROR: regex syntax error: empty alternate
let wrong_char_ranice = Regex::new("[z-a]");
//~^ERROR: regex syntax error: invalid character class range
2016-02-05 15:48:35 +00:00
let some_regex = Regex::new(OPENING_PAREN);
2016-02-05 20:54:29 +00:00
//~^ERROR: regex syntax error on position 0: unclosed
2016-02-05 15:48:35 +00:00
let closing_paren = ")";
let not_linted = Regex::new(closing_paren);
2016-02-04 23:36:06 +00:00
}