bump regex to 0.2

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2017-02-26 15:09:09 +01:00
parent b9dfd29ce6
commit 3323056893
3 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ cargo-fmt = []
toml = "0.2.1"
rustc-serialize = "0.3"
unicode-segmentation = "1.0.0"
regex = "0.1"
regex = "0.2"
term = "0.4"
strings = "0.0.1"
diff = "0.1"

View File

@ -32,7 +32,7 @@ pub struct StringFormat<'a> {
// FIXME: simplify this!
pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String> {
// Strip line breaks.
let re = Regex::new(r"([^\\](\\\\)*)\\[\n\r][:space:]*").unwrap();
let re = Regex::new(r"([^\\](\\\\)*)\\[\n\r][[:space:]]*").unwrap();
let stripped_str = re.replace_all(orig, "$1");
let graphemes = UnicodeSegmentation::graphemes(&*stripped_str, false).collect::<Vec<&str>>();

View File

@ -300,8 +300,8 @@ fn read_significant_comments(file_name: &str) -> HashMap<String, String> {
.take_while(|line| line_regex.is_match(&line))
.filter_map(|line| {
regex.captures_iter(&line).next().map(|capture| {
(capture.at(1).expect("Couldn't unwrap capture").to_owned(),
capture.at(2).expect("Couldn't unwrap capture").to_owned())
(capture.get(1).expect("Couldn't unwrap capture").as_str().to_owned(),
capture.get(2).expect("Couldn't unwrap capture").as_str().to_owned())
})
})
.collect()