fix warnings

This commit is contained in:
Quentin 2023-06-22 11:15:01 +02:00
parent 9d14868491
commit 39773d03ba
Signed by: quentin
GPG key ID: E9602264D639FF68
15 changed files with 19 additions and 36 deletions

View file

@ -2,14 +2,14 @@ use nom::{
IResult, IResult,
branch::alt, branch::alt,
bytes::complete::tag, bytes::complete::tag,
combinator::{into, opt, map_res}, combinator::{into, opt},
multi::separated_list1, multi::separated_list1,
sequence::tuple, sequence::tuple,
}; };
use crate::fragments::lazy; use crate::fragments::lazy;
use crate::fragments::model::{GroupRef, AddressRef, MailboxRef, MailboxList, AddressList}; 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::misc_token::phrase;
use crate::fragments::whitespace::{cfws}; use crate::fragments::whitespace::{cfws};
use crate::error::IMFError; use crate::error::IMFError;

View file

@ -1,16 +1,13 @@
use chrono::{DateTime, FixedOffset, NaiveDate, NaiveTime, TimeZone}; use chrono::{DateTime, FixedOffset, NaiveDate, NaiveTime};
use nom::{ use nom::{
IResult, IResult,
AsChar,
branch::alt, 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,
character::is_digit,
character::complete::{one_of, alphanumeric1, digit0}, character::complete::{one_of, alphanumeric1, digit0},
combinator::{map, opt, value}, combinator::{map, opt, value},
sequence::{preceded, terminated, tuple, delimited }, sequence::{preceded, terminated, tuple, delimited },
}; };
use crate::fragments::misc_token;
use crate::fragments::lazy; use crate::fragments::lazy;
use crate::fragments::whitespace::{fws, cfws}; use crate::fragments::whitespace::{fws, cfws};
use crate::error::IMFError; use crate::error::IMFError;

View file

@ -1,10 +1,8 @@
use std::borrow::Cow; use std::borrow::Cow;
use chrono::{DateTime, FixedOffset};
use nom::{ use nom::{
IResult, IResult,
Parser,
branch::alt, 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, character::complete::space0,
combinator::{map, opt, recognize}, combinator::{map, opt, recognize},
multi::{many0, many1, fold_many0, separated_list1}, multi::{many0, many1, fold_many0, separated_list1},
@ -15,13 +13,12 @@ use chardetng::EncodingDetector;
use encoding_rs::Encoding; use encoding_rs::Encoding;
use crate::fragments::whitespace::{fws, perm_crlf}; use crate::fragments::whitespace::{fws, perm_crlf};
use crate::fragments::words::vchar_seq;
use crate::fragments::misc_token::{phrase, unstructured}; 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::mailbox::mailbox;
use crate::fragments::address::{mailbox_list, address_list, address_list_cfws}; use crate::fragments::address::{mailbox_list, address_list, address_list_cfws};
use crate::fragments::identification::msg_id; use crate::fragments::identification::msg_id;
use crate::fragments::{datetime, trace, model}; use crate::fragments::{datetime, trace};
/// HEADERS /// HEADERS

View file

@ -1,4 +1,3 @@
use std::borrow::Cow;
use nom::{ use nom::{
IResult, IResult,
branch::alt, branch::alt,

View file

@ -1,12 +1,11 @@
use std::borrow::Cow; use std::borrow::Cow;
use nom::{ use nom::{
IResult, IResult,
Parser,
branch::alt, branch::alt,
bytes::complete::{tag, is_a}, bytes::complete::{tag, is_a},
character::complete::satisfy, character::complete::satisfy,
combinator::{into,map,opt,recognize}, combinator::{into,map,opt,recognize},
multi::{separated_list1, fold_many0, many0, many1}, multi::{separated_list1, fold_many0, many0},
sequence::{delimited,pair,preceded,terminated,tuple}, sequence::{delimited,pair,preceded,terminated,tuple},
}; };
@ -98,6 +97,7 @@ pub fn addr_spec(input: &str) -> IResult<&str, AddrSpec> {
/// ```abnf /// ```abnf
/// local-part = dot-atom / quoted-string / obs-local-part /// local-part = dot-atom / quoted-string / obs-local-part
/// ``` /// ```
#[allow(dead_code)]
fn strict_local_part(input: &str) -> IResult<&str, String> { fn strict_local_part(input: &str) -> IResult<&str, String> {
alt((into(dot_atom), quoted_string))(input) alt((into(dot_atom), quoted_string))(input)
} }
@ -126,6 +126,7 @@ fn obs_local_part(input: &str) -> IResult<&str, String> {
/// ```abnf /// ```abnf
/// domain = dot-atom / domain-literal /// domain = dot-atom / domain-literal
/// ``` /// ```
#[allow(dead_code)]
pub fn strict_domain(input: &str) -> IResult<&str, String> { pub fn strict_domain(input: &str) -> IResult<&str, String> {
alt((into(dot_atom), domain_litteral))(input) alt((into(dot_atom), domain_litteral))(input)
} }

View file

@ -6,7 +6,7 @@ use nom::{
character::complete::space0, character::complete::space0,
combinator::{into, opt}, combinator::{into, opt},
multi::{many0, many1, separated_list1}, multi::{many0, many1, separated_list1},
sequence::{pair, tuple}, sequence::tuple,
}; };
use crate::fragments::lazy; use crate::fragments::lazy;

View file

@ -1,5 +1,5 @@
use std::collections::HashMap; use std::collections::HashMap;
use chrono::{DateTime,FixedOffset,ParseError}; use chrono::{DateTime,FixedOffset};
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub struct AddrSpec { pub struct AddrSpec {

View file

@ -8,7 +8,6 @@ use nom::{
sequence::{pair, preceded}, sequence::{pair, preceded},
}; };
use crate::fragments::words::is_vchar;
use crate::fragments::whitespace::{fws, cfws, is_obs_no_ws_ctl}; use crate::fragments::whitespace::{fws, cfws, is_obs_no_ws_ctl};
/// Quoted pair /// Quoted pair

View file

@ -1,9 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use chrono::{DateTime, FixedOffset}; use chrono::{DateTime, FixedOffset};
use crate::fragments::model::{ use crate::fragments::model::{MailboxRef,MessageId, AddressRef};
MailboxList, MailboxRef, AddressList,
MessageId, MessageIdList, AddressRef};
use crate::fragments::misc_token::{Unstructured, PhraseList}; use crate::fragments::misc_token::{Unstructured, PhraseList};
use crate::fragments::trace::ReceivedLog; use crate::fragments::trace::ReceivedLog;
use crate::fragments::eager::Field; use crate::fragments::eager::Field;

View file

@ -1,12 +1,10 @@
use std::collections::HashMap;
use nom::{ use nom::{
IResult, IResult,
branch::alt, branch::alt,
bytes::complete::tag, bytes::complete::tag,
character::complete::space0,
combinator::{map, opt, recognize}, combinator::{map, opt, recognize},
multi::many0, multi::many0,
sequence::{delimited, pair, tuple}, sequence::tuple,
}; };
use crate::fragments::{datetime, mailbox, model, misc_token, whitespace, lazy}; use crate::fragments::{datetime, mailbox, model, misc_token, whitespace, lazy};
use crate::error::IMFError; use crate::error::IMFError;

View file

@ -5,7 +5,7 @@ use nom::{
character::complete::{crlf, satisfy, space0, space1}, character::complete::{crlf, satisfy, space0, space1},
combinator::{recognize, opt}, combinator::{recognize, opt},
multi::{many0, many1}, multi::{many0, many1},
sequence::{pair, tuple}, sequence::tuple,
}; };
use crate::fragments::quoted::quoted_pair; use crate::fragments::quoted::quoted_pair;

View file

@ -21,6 +21,7 @@ pub fn is_vchar(c: char) -> bool {
/// VCHAR =/ UTF8-non-ascii /// VCHAR =/ UTF8-non-ascii
/// SEQ = 1*VCHAR /// SEQ = 1*VCHAR
///``` ///```
#[allow(dead_code)]
pub fn vchar_seq(input: &str) -> IResult<&str, &str> { pub fn vchar_seq(input: &str) -> IResult<&str, &str> {
take_while1(is_vchar)(input) 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) delimited(opt(cfws), dot_atom_text, opt(cfws))(input)
} }
#[allow(dead_code)]
pub fn is_special(c: char) -> bool { pub fn is_special(c: char) -> bool {
c == '(' || c == ')' || c == '(' || c == ')' ||
c == '<' || c == '>' || c == '<' || c == '>' ||

View file

@ -1,10 +1,9 @@
use std::borrow::Cow;
use nom::{ use nom::{
IResult, IResult,
character::complete::space1, character::complete::space1,
bytes::complete::is_not, bytes::complete::is_not,
combinator::{all_consuming, recognize}, combinator::{all_consuming, recognize},
multi::{fold_many0, many0, many1}, multi::{many0, many1},
sequence::{pair, tuple}, sequence::{pair, tuple},
}; };

View file

@ -1,4 +1,3 @@
use std::convert::TryFrom;
use nom::{ use nom::{
IResult, IResult,
branch::alt, branch::alt,

View file

@ -1,10 +1,4 @@
use imf_codec::multipass::{ use imf_codec::multipass::segment;
segment,
guess_charset,
field_lazy,
field_eager,
header_section
};
use imf_codec::fragments::section::Section; use imf_codec::fragments::section::Section;
use std::io; use std::io;
use std::io::Read; use std::io::Read;