Updating nom to 4.2

This commit is contained in:
Rodolphe Breard 2019-03-03 15:23:31 +01:00
parent 22c376930b
commit 866298c948
3 changed files with 6 additions and 12 deletions

View file

@ -13,7 +13,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE-*.txt"]
[dependencies] [dependencies]
log = {version = "0.4", features = ["std"]} log = {version = "0.4", features = ["std"]}
nom = "4.1" nom = "4.2"
opensmtpd_derive = { path = "../opensmtpd-derive", version = "0.1" } opensmtpd_derive = { path = "../opensmtpd-derive", version = "0.1" }
[[example]] [[example]]

View file

@ -7,10 +7,7 @@
// except according to those terms. // except according to those terms.
use crate::errors::Error; use crate::errors::Error;
use nom::{ use nom::{alt_complete, call, cond, do_parse, map_res, named, opt, tag, take_until, take_while};
alt, alt_complete, call, complete, cond, do_parse, error_position, map_res, named, opt, tag,
take_until, take_while,
};
use std::str::FromStr; use std::str::FromStr;
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
@ -48,8 +45,7 @@ impl FromStr for Event {
type Err = Error; type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s let s = s.to_lowercase()
.to_lowercase()
.replace("link", "link-") .replace("link", "link-")
.replace("tx", "tx-") .replace("tx", "tx-")
.replace("protocol", "protocol-") .replace("protocol", "protocol-")

View file

@ -89,11 +89,9 @@ impl<T: Clone + Default + 'static> SmtpIn<T> {
let mut evts = Vec::new(); let mut evts = Vec::new();
for eh in self.event_handlers.iter() { for eh in self.event_handlers.iter() {
match eh.event { match eh.event {
MatchEvent::Evt(ref v) => { MatchEvent::Evt(ref v) => for e in v.iter() {
for e in v.iter() { evts.push(e);
evts.push(e); },
}
}
MatchEvent::All => { MatchEvent::All => {
println!("register|report|smtp-in|*"); println!("register|report|smtp-in|*");
evts.clear(); evts.clear();