get rid of warnings

This commit is contained in:
Michael Zhang 2021-08-08 18:45:18 -05:00
parent 3cc65d5ce7
commit aae287c8b1
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
9 changed files with 73 additions and 42 deletions

View file

@ -1,2 +1,14 @@
use anyhow::Result;
use imap::client::ConfigBuilder;
#[tokio::main]
async fn main() {}
async fn main() -> Result<()> {
let _client = ConfigBuilder::default()
.hostname(String::from("localhost"))
.port(3993)
.tls(true)
.connect()
.await?;
Ok(())
}

View file

@ -28,6 +28,6 @@ impl AuthMethod for Login {
password: &self.password,
});
let result = inner.execute(command).await;
let _result = inner.execute(command).await;
}
}

View file

@ -44,7 +44,7 @@ where
})
}
pub async fn execute<'a>(&mut self, command: Command<'a>) {}
pub async fn execute<'a>(&mut self, _command: Command<'a>) {}
pub async fn upgrade(self) -> Result<Inner<TlsStream<C>>> {
// TODO: check that this capability exists??

View file

@ -4,16 +4,17 @@ pub mod upgrade;
use anyhow::Result;
#[derive(Debug, Builder)]
#[derive(Clone, Debug, Builder)]
#[builder(build_fn(skip))]
pub struct Config {
// (required for TLS)
hostname: String,
port: u16,
tls: bool,
}
impl ConfigBuilder {
pub async fn build() -> Result<Client> { todo!() }
pub async fn connect(&self) -> Result<Client> { todo!() }
}
pub struct Client;

View file

@ -80,7 +80,7 @@ pub struct OwnedResponse {
}
impl OwnedResponse {
pub fn request_id(&self) -> Option<&Tag> {
pub fn _request_id(&self) -> Option<&Tag> {
match self.response {
Response::Done(ResponseDone { ref tag, .. }) => Some(tag),
_ => None,
@ -88,5 +88,5 @@ impl OwnedResponse {
}
#[allow(clippy::needless_lifetimes)]
pub fn parsed<'a>(&'a self) -> &'a Response<'a> { &self.response }
pub fn _parsed<'a>(&'a self) -> &'a Response<'a> { &self.response }
}

View file

@ -1,8 +1,8 @@
#[macro_use]
// #[macro_use]
extern crate anyhow;
#[macro_use]
extern crate async_trait;
#[macro_use]
// #[macro_use]
extern crate log;
#[macro_use]
extern crate futures;
@ -11,9 +11,7 @@ extern crate derive_builder;
#[macro_use]
extern crate bitflags;
// mod auth;
pub mod client;
mod codec;
mod events;
// mod inner;
pub mod codec;
pub mod events;
pub mod proto;

View file

@ -6,18 +6,18 @@ macro_rules! rule {
};
}
macro_rules! pred {
($($expr:tt)*) => { |c: u8| _pred!(expr { $($expr)* })(c) };
}
// macro_rules! pred {
// ($($expr:tt)*) => { |c: u8| _pred!(expr { $($expr)* })(c) };
// }
macro_rules! _pred {
(expr {}) => {};
(expr { $name:ident }) => { |b| $name(b) };
(expr { ! $($expr:tt)* }) => { |b| !_pred!(expr { $($expr)* })(b) };
(expr { ($($L:tt)*) && ($($R:tt)*) }) => {
|b| { _pred!(expr { $($L)* })(b) && _pred!(expr { $($R)* })(b) }
};
(expr { ($($L:tt)*) || ($($R:tt)*) }) => {
|b| { _pred!(expr { $($L)* })(b) || _pred!(expr { $($R)* })(b) }
};
}
// macro_rules! _pred {
// (expr {}) => {};
// (expr { $name:ident }) => { |b| $name(b) };
// (expr { ! $($expr:tt)* }) => { |b| !_pred!(expr { $($expr)* })(b) };
// (expr { ($($L:tt)*) && ($($R:tt)*) }) => {
// |b| { _pred!(expr { $($L)* })(b) && _pred!(expr { $($R)* })(b) }
// };
// (expr { ($($L:tt)*) || ($($R:tt)*) }) => {
// |b| { _pred!(expr { $($L)* })(b) || _pred!(expr { $($R)* })(b) }
// };
// }

View file

@ -7,20 +7,40 @@ use nom::{
macro_rules! sep_list {
($t:expr) => {
map(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t))),
|(hd, mut tl)| { tl.insert(0, hd); tl })
map(
pair($t, many0(preceded(crate::proto::rfc2234::SP, $t))),
|(hd, mut tl)| {
tl.insert(0, hd);
tl
},
)
};
($t:expr, $d:expr) => {
map(pair($t, many0(preceded($d, $t))),
|(hd, mut tl)| { tl.insert(0, hd); tl })
map(pair($t, many0(preceded($d, $t))), |(hd, mut tl)| {
tl.insert(0, hd);
tl
})
};
(? $t:expr) => {
map(opt(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t)))),
|opt| opt.map(|(hd, mut tl)| { tl.insert(0, hd); tl }).unwrap_or_else(Vec::new))
map(
opt(pair($t, many0(preceded(crate::proto::rfc2234::SP, $t)))),
|opt| {
opt.map(|(hd, mut tl)| {
tl.insert(0, hd);
tl
})
.unwrap_or_else(Vec::new)
},
)
};
(? $t:expr, $d:expr) => {
map(opt(pair($t, many0(preceded($d, $t)))),
|opt| opt.map(|(hd, mut tl)| { tl.insert(0, hd); tl }).unwrap_or_else(Vec::new))
map(opt(pair($t, many0(preceded($d, $t)))), |opt| {
opt.map(|(hd, mut tl)| {
tl.insert(0, hd);
tl
})
.unwrap_or_else(Vec::new)
})
};
}

View file

@ -6,16 +6,16 @@ use nom::{
branch::alt,
bytes::streaming::{tag_no_case, take, take_while1},
character::streaming::char,
combinator::{map, verify, map_res, opt},
multi::{many0},
sequence::{delimited, pair, tuple, preceded, separated_pair, terminated},
combinator::{map, map_res, opt, verify},
multi::many0,
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
IResult,
};
use super::parsers::{byte, never, satisfy};
use super::response::{
Atom, Capability, Condition, CowU8, Flag, Mailbox, MailboxData, MailboxList, MailboxListFlag,
Response, ResponseCode, Status, Tag, MessageAttribute, Envelope, ResponseText,
Atom, Capability, Condition, CowU8, Envelope, Flag, Mailbox, MailboxData, MailboxList,
MailboxListFlag, MessageAttribute, Response, ResponseCode, ResponseText, Status, Tag,
};
use super::rfc2234::{is_char, is_cr, is_ctl, is_digit, is_dquote, is_lf, is_sp, CRLF, DQUOTE, SP};