diff --git a/src/fragments/address.rs b/src/fragments/address.rs index 16515b8..6aefbb0 100644 --- a/src/fragments/address.rs +++ b/src/fragments/address.rs @@ -2,14 +2,14 @@ use nom::{ IResult, branch::alt, bytes::complete::tag, - combinator::{into, opt, map_res}, + combinator::{into, opt}, multi::separated_list1, sequence::tuple, }; use crate::fragments::lazy; use crate::fragments::model::{GroupRef, AddressRef, MailboxRef, MailboxList, AddressList}; -use crate::fragments::mailbox::{addr_spec, mailbox}; +use crate::fragments::mailbox::mailbox; use crate::fragments::misc_token::phrase; use crate::fragments::whitespace::{cfws}; use crate::error::IMFError; diff --git a/src/fragments/datetime.rs b/src/fragments/datetime.rs index 34d68e4..44e2661 100644 --- a/src/fragments/datetime.rs +++ b/src/fragments/datetime.rs @@ -1,16 +1,13 @@ -use chrono::{DateTime, FixedOffset, NaiveDate, NaiveTime, TimeZone}; +use chrono::{DateTime, FixedOffset, NaiveDate, NaiveTime}; use nom::{ IResult, - AsChar, branch::alt, - bytes::complete::{tag, tag_no_case, take_while, take_while1, take_while_m_n, is_a}, + bytes::complete::{tag, tag_no_case, take_while_m_n, is_a}, character, - character::is_digit, character::complete::{one_of, alphanumeric1, digit0}, combinator::{map, opt, value}, sequence::{preceded, terminated, tuple, delimited }, }; -use crate::fragments::misc_token; use crate::fragments::lazy; use crate::fragments::whitespace::{fws, cfws}; use crate::error::IMFError; diff --git a/src/fragments/header.rs b/src/fragments/header.rs index f4bb76b..70fb97c 100644 --- a/src/fragments/header.rs +++ b/src/fragments/header.rs @@ -1,10 +1,8 @@ use std::borrow::Cow; -use chrono::{DateTime, FixedOffset}; use nom::{ IResult, - Parser, branch::alt, - bytes::complete::{is_not, take_while1, take_while, tag, tag_no_case}, + bytes::complete::{is_not, take_while1, tag, tag_no_case}, character::complete::space0, combinator::{map, opt, recognize}, multi::{many0, many1, fold_many0, separated_list1}, @@ -15,13 +13,12 @@ use chardetng::EncodingDetector; use encoding_rs::Encoding; use crate::fragments::whitespace::{fws, perm_crlf}; -use crate::fragments::words::vchar_seq; use crate::fragments::misc_token::{phrase, unstructured}; -use crate::fragments::model::{HeaderSection, MailboxRef, AddressRef, Field, FieldBody}; +use crate::fragments::model::{HeaderSection, Field, FieldBody}; use crate::fragments::mailbox::mailbox; use crate::fragments::address::{mailbox_list, address_list, address_list_cfws}; use crate::fragments::identification::msg_id; -use crate::fragments::{datetime, trace, model}; +use crate::fragments::{datetime, trace}; /// HEADERS diff --git a/src/fragments/identification.rs b/src/fragments/identification.rs index 42fa843..912e717 100644 --- a/src/fragments/identification.rs +++ b/src/fragments/identification.rs @@ -1,4 +1,3 @@ -use std::borrow::Cow; use nom::{ IResult, branch::alt, diff --git a/src/fragments/mailbox.rs b/src/fragments/mailbox.rs index 719fd6a..337bacd 100644 --- a/src/fragments/mailbox.rs +++ b/src/fragments/mailbox.rs @@ -1,12 +1,11 @@ use std::borrow::Cow; use nom::{ IResult, - Parser, branch::alt, bytes::complete::{tag, is_a}, character::complete::satisfy, combinator::{into,map,opt,recognize}, - multi::{separated_list1, fold_many0, many0, many1}, + multi::{separated_list1, fold_many0, many0}, sequence::{delimited,pair,preceded,terminated,tuple}, }; @@ -98,6 +97,7 @@ pub fn addr_spec(input: &str) -> IResult<&str, AddrSpec> { /// ```abnf /// local-part = dot-atom / quoted-string / obs-local-part /// ``` +#[allow(dead_code)] fn strict_local_part(input: &str) -> IResult<&str, String> { alt((into(dot_atom), quoted_string))(input) } @@ -126,6 +126,7 @@ fn obs_local_part(input: &str) -> IResult<&str, String> { /// ```abnf /// domain = dot-atom / domain-literal /// ``` +#[allow(dead_code)] pub fn strict_domain(input: &str) -> IResult<&str, String> { alt((into(dot_atom), domain_litteral))(input) } diff --git a/src/fragments/misc_token.rs b/src/fragments/misc_token.rs index 44ddd89..19d7cdb 100644 --- a/src/fragments/misc_token.rs +++ b/src/fragments/misc_token.rs @@ -6,7 +6,7 @@ use nom::{ character::complete::space0, combinator::{into, opt}, multi::{many0, many1, separated_list1}, - sequence::{pair, tuple}, + sequence::tuple, }; use crate::fragments::lazy; diff --git a/src/fragments/model.rs b/src/fragments/model.rs index 31665f0..e28eb2d 100644 --- a/src/fragments/model.rs +++ b/src/fragments/model.rs @@ -1,5 +1,5 @@ use std::collections::HashMap; -use chrono::{DateTime,FixedOffset,ParseError}; +use chrono::{DateTime,FixedOffset}; #[derive(Debug, PartialEq)] pub struct AddrSpec { diff --git a/src/fragments/quoted.rs b/src/fragments/quoted.rs index 0214276..6a593a0 100644 --- a/src/fragments/quoted.rs +++ b/src/fragments/quoted.rs @@ -8,7 +8,6 @@ use nom::{ sequence::{pair, preceded}, }; -use crate::fragments::words::is_vchar; use crate::fragments::whitespace::{fws, cfws, is_obs_no_ws_ctl}; /// Quoted pair diff --git a/src/fragments/section.rs b/src/fragments/section.rs index cff2938..6ebb5a9 100644 --- a/src/fragments/section.rs +++ b/src/fragments/section.rs @@ -1,9 +1,7 @@ use std::collections::HashMap; use chrono::{DateTime, FixedOffset}; -use crate::fragments::model::{ - MailboxList, MailboxRef, AddressList, - MessageId, MessageIdList, AddressRef}; +use crate::fragments::model::{MailboxRef,MessageId, AddressRef}; use crate::fragments::misc_token::{Unstructured, PhraseList}; use crate::fragments::trace::ReceivedLog; use crate::fragments::eager::Field; diff --git a/src/fragments/trace.rs b/src/fragments/trace.rs index d15dfd9..fce668c 100644 --- a/src/fragments/trace.rs +++ b/src/fragments/trace.rs @@ -1,12 +1,10 @@ -use std::collections::HashMap; use nom::{ IResult, branch::alt, bytes::complete::tag, - character::complete::space0, combinator::{map, opt, recognize}, multi::many0, - sequence::{delimited, pair, tuple}, + sequence::tuple, }; use crate::fragments::{datetime, mailbox, model, misc_token, whitespace, lazy}; use crate::error::IMFError; diff --git a/src/fragments/whitespace.rs b/src/fragments/whitespace.rs index f5dde09..19ec292 100644 --- a/src/fragments/whitespace.rs +++ b/src/fragments/whitespace.rs @@ -5,7 +5,7 @@ use nom::{ character::complete::{crlf, satisfy, space0, space1}, combinator::{recognize, opt}, multi::{many0, many1}, - sequence::{pair, tuple}, + sequence::tuple, }; use crate::fragments::quoted::quoted_pair; diff --git a/src/fragments/words.rs b/src/fragments/words.rs index fe9f369..1cc8d1c 100644 --- a/src/fragments/words.rs +++ b/src/fragments/words.rs @@ -21,6 +21,7 @@ pub fn is_vchar(c: char) -> bool { /// VCHAR =/ UTF8-non-ascii /// SEQ = 1*VCHAR ///``` +#[allow(dead_code)] pub fn vchar_seq(input: &str) -> IResult<&str, &str> { take_while1(is_vchar)(input) } @@ -51,6 +52,7 @@ pub fn dot_atom(input: &str) -> IResult<&str, &str> { delimited(opt(cfws), dot_atom_text, opt(cfws))(input) } +#[allow(dead_code)] pub fn is_special(c: char) -> bool { c == '(' || c == ')' || c == '<' || c == '>' || diff --git a/src/multipass/extract_fields.rs b/src/multipass/extract_fields.rs index a413ef8..fc401af 100644 --- a/src/multipass/extract_fields.rs +++ b/src/multipass/extract_fields.rs @@ -1,10 +1,9 @@ -use std::borrow::Cow; use nom::{ IResult, character::complete::space1, bytes::complete::is_not, combinator::{all_consuming, recognize}, - multi::{fold_many0, many0, many1}, + multi::{many0, many1}, sequence::{pair, tuple}, }; diff --git a/src/multipass/segment.rs b/src/multipass/segment.rs index ef72777..db9a8d3 100644 --- a/src/multipass/segment.rs +++ b/src/multipass/segment.rs @@ -1,4 +1,3 @@ -use std::convert::TryFrom; use nom::{ IResult, branch::alt, diff --git a/src/parse.rs b/src/parse.rs index c9d7031..74f3edb 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1,10 +1,4 @@ -use imf_codec::multipass::{ - segment, - guess_charset, - field_lazy, - field_eager, - header_section -}; +use imf_codec::multipass::segment; use imf_codec::fragments::section::Section; use std::io; use std::io::Read;