diff --git a/opensmtpd-derive/src/lib.rs b/opensmtpd-derive/src/lib.rs index 00dec74..72999d1 100644 --- a/opensmtpd-derive/src/lib.rs +++ b/opensmtpd-derive/src/lib.rs @@ -9,8 +9,8 @@ extern crate proc_macro; use proc_macro::TokenStream; -use syn::{parse_macro_input, ItemFn}; use quote::quote; +use syn::{parse_macro_input, ItemFn}; fn get_type( params: &syn::punctuated::Punctuated, @@ -23,7 +23,7 @@ fn get_type( }, })); let cb = syn::Type::Verbatim(syn::TypeVerbatim { - tts: quote!{ opensmtpd::Callback::NoCtx }, + tts: quote! { opensmtpd::Callback::NoCtx }, }); Ok((ctx, cb)) } @@ -32,10 +32,10 @@ fn get_type( syn::Type::Reference(r) => { let cb = match r.mutability { Some(_) => syn::Type::Verbatim(syn::TypeVerbatim { - tts: quote!{ opensmtpd::Callback::CtxMut }, + tts: quote! { opensmtpd::Callback::CtxMut }, }), None => syn::Type::Verbatim(syn::TypeVerbatim { - tts: quote!{ opensmtpd::Callback::Ctx }, + tts: quote! { opensmtpd::Callback::Ctx }, }), }; Ok((r.elem.clone(), cb)) diff --git a/opensmtpd/src/entry.rs b/opensmtpd/src/entry.rs index 60bf1e7..c4e0372 100644 --- a/opensmtpd/src/entry.rs +++ b/opensmtpd/src/entry.rs @@ -7,8 +7,10 @@ // except according to those terms. use crate::errors::Error; -use nom::{alt, alt_complete, call, complete, cond, do_parse, error_position, map_res, named, opt, - tag, take_until, take_while}; +use nom::{ + alt, alt_complete, call, complete, cond, do_parse, error_position, map_res, named, opt, tag, + take_until, take_while, +}; use std::str::FromStr; #[derive(Clone, Debug, PartialEq)] @@ -46,7 +48,8 @@ impl FromStr for Event { type Err = Error; fn from_str(s: &str) -> Result { - let s = s.to_lowercase() + let s = s + .to_lowercase() .replace("link", "link-") .replace("tx", "tx-") .replace("protocol", "protocol-") diff --git a/opensmtpd/src/event_handlers.rs b/opensmtpd/src/event_handlers.rs index c8c0477..361eb97 100644 --- a/opensmtpd/src/event_handlers.rs +++ b/opensmtpd/src/event_handlers.rs @@ -35,9 +35,11 @@ fn get_events_from_string(event_str: &str) -> MatchEvent { "Any" | "All" => { return MatchEvent::All; } - _ => if let Ok(e) = Event::from_str(name) { - events.push(e); - }, + _ => { + if let Ok(e) = Event::from_str(name) { + events.push(e); + } + } } } MatchEvent::Evt(events) diff --git a/opensmtpd/src/lib.rs b/opensmtpd/src/lib.rs index 4d307e3..9588439 100644 --- a/opensmtpd/src/lib.rs +++ b/opensmtpd/src/lib.rs @@ -89,9 +89,11 @@ impl SmtpIn { let mut evts = Vec::new(); for eh in self.event_handlers.iter() { match eh.event { - MatchEvent::Evt(ref v) => for e in v.iter() { - evts.push(e); - }, + MatchEvent::Evt(ref v) => { + for e in v.iter() { + evts.push(e); + } + } MatchEvent::All => { println!("register|report|smtp-in|*"); evts.clear();