From 9c3a4b8c3939a56b8e708069dd0f7239014f5c53 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 1 Mar 2021 01:48:28 -0600 Subject: [PATCH] fix clippy --- imap/src/client/inner.rs | 15 +++++---------- imap/src/client/mod.rs | 4 ++-- imap/src/parser/mod.rs | 8 ++------ src/main.rs | 3 --- src/ui/table.rs | 30 +++++++++++++++--------------- 5 files changed, 24 insertions(+), 36 deletions(-) diff --git a/imap/src/client/inner.rs b/imap/src/client/inner.rs index 30a9d9c..7e068c6 100644 --- a/imap/src/client/inner.rs +++ b/imap/src/client/inner.rs @@ -1,19 +1,14 @@ -use std::collections::{HashMap, HashSet, VecDeque}; -use std::mem; +use std::collections::{HashSet, VecDeque}; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll, Waker}; use anyhow::{Context as AnyhowContext, Error, Result}; use futures::{ - future::{self, BoxFuture, Either, Future, FutureExt, TryFutureExt}, - stream::{BoxStream, Stream, StreamExt, TryStream}, + future::{self, Either, Future, FutureExt, TryFutureExt}, + stream::StreamExt, }; -use genawaiter::{ - sync::{gen, Gen}, - yield_, -}; -use parking_lot::{RwLock, RwLockWriteGuard}; +use parking_lot::RwLock; use tokio::{ io::{ self, AsyncBufReadExt, AsyncRead, AsyncWrite, AsyncWriteExt, BufReader, ReadHalf, WriteHalf, @@ -38,7 +33,7 @@ pub type ResponseSender = mpsc::UnboundedSender; pub type ResponseStream = mpsc::UnboundedReceiver; type ResultQueue = Arc>>; pub type GreetingState = Arc, Option)>>; -pub const TAG_PREFIX: &str = "panorama"; +pub const TAG_PREFIX: &str = "ptag"; struct HandlerResult { id: usize, diff --git a/imap/src/client/mod.rs b/imap/src/client/mod.rs index 4ecf9e3..38eb285 100644 --- a/imap/src/client/mod.rs +++ b/imap/src/client/mod.rs @@ -153,7 +153,7 @@ impl ClientAuthenticated { reference: "".to_owned(), mailbox: "*".to_owned(), }; - let (resp, stream) = self.execute(cmd).await?; + let (resp, _) = self.execute(cmd).await?; let resp = resp.await?; debug!("list response: {:?}", resp); Ok(()) @@ -164,7 +164,7 @@ impl ClientAuthenticated { let cmd = Command::Select { mailbox: mailbox.as_ref().to_owned(), }; - let (resp, stream) = self.execute(cmd).await?; + let (resp, _) = self.execute(cmd).await?; let resp = resp.await?; debug!("select response: {:?}", resp); Ok(()) diff --git a/imap/src/parser/mod.rs b/imap/src/parser/mod.rs index 34c317e..016a6f4 100644 --- a/imap/src/parser/mod.rs +++ b/imap/src/parser/mod.rs @@ -3,11 +3,7 @@ use std::fmt::Debug; use std::str::FromStr; -use pest::{ - error::Error, - iterators::{Pair, Pairs}, - Parser, -}; +use pest::{error::Error, iterators::Pair, Parser}; use crate::response::*; @@ -156,7 +152,7 @@ fn build_msg_att_static(pair: Pair) -> AttributeValue { } } -fn build_envelope(pair: Pair) -> Envelope { +fn build_envelope(_pair: Pair) -> Envelope { // TODO: do this Envelope::default() } diff --git a/src/main.rs b/src/main.rs index 4bc6a89..abc4ecb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,3 @@ -#[macro_use] -extern crate log; - use std::path::{Path, PathBuf}; use std::thread; diff --git a/src/ui/table.rs b/src/ui/table.rs index 26c6019..87eac56 100644 --- a/src/ui/table.rs +++ b/src/ui/table.rs @@ -60,21 +60,21 @@ impl Widget for Table { for (i, row) in self.rows.iter().enumerate() { // queue!(w, cursor::MoveTo(rect.x, rect.y + i as u16))?; - if let Some(v) = self.selected_row { - if v == i as u16 { - // queue!( - // w, - // style::SetBackgroundColor(Color::White), - // style::SetForegroundColor(Color::Black) - // )?; - } else { - // queue!( - // w, - // style::SetForegroundColor(Color::White), - // style::SetBackgroundColor(Color::Black) - // )?; - } - } + // if let Some(v) = self.selected_row { + // if v == i as u16 { + // // queue!( + // // w, + // // style::SetBackgroundColor(Color::White), + // // style::SetForegroundColor(Color::Black) + // // )?; + // } else { + // // queue!( + // // w, + // // style::SetForegroundColor(Color::White), + // // style::SetBackgroundColor(Color::Black) + // // )?; + // } + // } let mut s = String::with_capacity(rect.w as usize); for (j, cell) in row.iter().enumerate() { s += &cell;