Merge pull request #878 from matthiasbeyer/update-regex

Update regex to 0.2.*
This commit is contained in:
Matthias Beyer 2017-01-30 12:09:37 +01:00 committed by GitHub
commit 3c7edcfb50
10 changed files with 28 additions and 17 deletions

View file

@ -18,7 +18,7 @@ clap = ">=2.17"
filters = "0.1.*"
itertools = "0.5"
log = "0.3"
regex = "0.1"
regex = "0.2"
semver = "0.5.*"
toml = "0.2.*"

View file

@ -16,7 +16,7 @@ homepage = "http://imag-pim.org"
[dependencies]
clap = ">=2.17"
log = "0.3"
regex = "0.1"
regex = "0.2"
toml = "0.2.*"
itertools = "0.5"

View file

@ -19,7 +19,7 @@ clap = ">=2.17"
interactor = "0.1"
lazy_static = "0.2.*"
log = "0.3"
regex = "0.1"
regex = "0.2"
toml = "0.2.1"
spinner = "0.4"
rustyline = "1.0"

View file

@ -18,7 +18,7 @@ fs2 = "0.4"
glob = "0.2.11"
lazy_static = "0.2.*"
log = "0.3"
regex = "0.1"
regex = "0.2"
semver = "0.5"
toml = "0.2.*"
version = "2.0.1"

View file

@ -1182,13 +1182,13 @@ impl Entry {
Some(s) => s
};
let content = matches.name("content").unwrap_or("");
let content = matches.name("content").map(|r| r.as_str()).unwrap_or("");
debug!("Header and content found. Yay! Building Entry object now");
Ok(Entry {
location: try!(loc.into_storeid()),
header: try!(EntryHeader::parse(header)),
content: content.into(),
header: try!(EntryHeader::parse(header.as_str())),
content: String::from(content),
})
}

View file

@ -18,7 +18,7 @@ clap = ">=2.17"
lazy_static = "0.2"
log = "0.3"
chrono = "0.2"
regex = "0.1"
regex = "0.2"
[dependencies.libimagerror]
path = "../libimagerror"

View file

@ -73,9 +73,9 @@ impl Parse for Date {
R.captures(s)
.and_then(|capts| {
let year = capts.name("Y").and_then(|o| FromStr::from_str(o).ok());
let month = capts.name("M").and_then(|o| FromStr::from_str(o).ok());
let day = capts.name("D").and_then(|o| FromStr::from_str(o).ok());
let year = capts.name("Y").and_then(|o| FromStr::from_str(o.as_str()).ok());
let month = capts.name("M").and_then(|o| FromStr::from_str(o.as_str()).ok());
let day = capts.name("D").and_then(|o| FromStr::from_str(o.as_str()).ok());
let year = match year {
None => {

View file

@ -72,9 +72,18 @@ impl Parse for Time {
R.captures(s)
.and_then(|capts| {
let minute = capts.name("m").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
let second = capts.name("s").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
let hour = match capts.name("h").and_then(|o| FromStr::from_str(o).ok()) {
let minute = capts
.name("m")
.and_then(|o| FromStr::from_str(o.as_str()).ok())
.unwrap_or(0);
let second = capts
.name("s")
.and_then(|o| FromStr::from_str(o.as_str()).ok())
.unwrap_or(0);
let hour = match capts
.name("h")
.and_then(|o| FromStr::from_str(o.as_str()).ok())
{
None => {
debug!("No hour");
return None;

View file

@ -18,6 +18,6 @@ url = "1.2"
boolinator = "2.4.0"
lazy_static = "0.2"
log = "0.3"
regex = "0.1"
regex = "0.2"
tempfile = "2.1"

View file

@ -75,10 +75,12 @@ impl IntoKeyValue<String, String> for String {
.unwrap();
}
R.captures(&self[..])
.map(|caps| caps.name("VALUE").or(caps.name("QVALUE")).unwrap_or(""))
.map(|c| c.name("VALUE").or(c.name("QVALUE")).map(|m| m.as_str()).unwrap_or(""))
};
key.and_then(|k| value.and_then(|v| Some(KeyValue::new(String::from(k), String::from(v)))))
key.and_then(|k| {
value.and_then(|v| Some(KeyValue::new(String::from(k.as_str()), String::from(v))))
})
}
}