Fix some unused etc warnings
parent
b823969ae2
commit
5dc477bcd5
|
@ -50,8 +50,6 @@ pub struct Work {
|
|||
priority: u64,
|
||||
pub is_static: bool,
|
||||
pub closure: Box<dyn FnOnce(WorkContext) -> () + Send + Sync>,
|
||||
name: String,
|
||||
status: String,
|
||||
}
|
||||
|
||||
impl Ord for Work {
|
||||
|
@ -169,8 +167,6 @@ where
|
|||
priority: self.priority,
|
||||
is_static: self.is_static,
|
||||
closure: work,
|
||||
name: String::new(),
|
||||
status: String::new(),
|
||||
}),
|
||||
tx: self.tx,
|
||||
rx: self.rx,
|
||||
|
|
|
@ -264,7 +264,7 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|||
fn operation(&self, hash: EnvelopeHash) -> Box<dyn BackendOp>;
|
||||
|
||||
fn save(&self, bytes: &[u8], folder: &str, flags: Option<Flag>) -> Result<()>;
|
||||
fn create_folder(&mut self, path: String) -> Result<Folder> {
|
||||
fn create_folder(&mut self, _path: String) -> Result<Folder> {
|
||||
unimplemented!()
|
||||
}
|
||||
fn tags(&self) -> Option<Arc<RwLock<BTreeMap<u64, String>>>> {
|
||||
|
|
|
@ -339,7 +339,7 @@ impl ImapConnection {
|
|||
}
|
||||
|
||||
pub fn read_response(&mut self, ret: &mut String) -> Result<()> {
|
||||
let res = self.try_send(|s| s.read_response(ret));
|
||||
self.try_send(|s| s.read_response(ret))?;
|
||||
let r: Result<()> = ImapResponse::from(&ret).into();
|
||||
r
|
||||
}
|
||||
|
|
|
@ -301,13 +301,6 @@ impl ThreadGroup {
|
|||
None
|
||||
}
|
||||
}
|
||||
fn root_mut(&mut self) -> Option<&mut Thread> {
|
||||
if let ThreadGroup::Root(ref mut root) = self {
|
||||
Some(root)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! property {
|
||||
|
@ -410,71 +403,6 @@ impl ThreadNode {
|
|||
pub fn children(&self) -> &[ThreadNodeHash] {
|
||||
&self.children
|
||||
}
|
||||
|
||||
fn insert_child_pos(
|
||||
vec: &[ThreadNodeHash],
|
||||
child: ThreadNodeHash,
|
||||
sort: (SortField, SortOrder),
|
||||
buf: &mut FnvHashMap<ThreadNodeHash, ThreadNode>,
|
||||
dates: &FnvHashMap<ThreadNodeHash, UnixTimestamp>,
|
||||
envelopes: &Envelopes,
|
||||
) -> std::result::Result<usize, usize> {
|
||||
let envelopes = envelopes.read().unwrap();
|
||||
match sort {
|
||||
(SortField::Date, SortOrder::Asc) => {
|
||||
vec.binary_search_by(|probe| dates[probe].cmp(&dates[&child]))
|
||||
}
|
||||
(SortField::Date, SortOrder::Desc) => {
|
||||
vec.binary_search_by(|probe| dates[probe].cmp(&dates[&child]).reverse())
|
||||
}
|
||||
(SortField::Subject, SortOrder::Asc) => vec.binary_search_by(|probe| {
|
||||
match (
|
||||
buf.get(&probe).map(|n| n.message.as_ref()).unwrap_or(None),
|
||||
buf.get(&child).map(|n| n.message.as_ref()).unwrap_or(None),
|
||||
) {
|
||||
(Some(p), Some(c)) => {
|
||||
#[cfg(feature = "unicode_algorithms")]
|
||||
{
|
||||
envelopes[p]
|
||||
.subject()
|
||||
.split_graphemes()
|
||||
.cmp(&envelopes[c].subject().split_graphemes())
|
||||
}
|
||||
#[cfg(not(feature = "unicode_algorithms"))]
|
||||
{
|
||||
envelopes[p].subject().cmp(&envelopes[c].subject())
|
||||
}
|
||||
}
|
||||
(Some(_), None) => Ordering::Greater,
|
||||
(None, Some(_)) => Ordering::Less,
|
||||
(None, None) => Ordering::Equal,
|
||||
}
|
||||
}),
|
||||
(SortField::Subject, SortOrder::Desc) => vec.binary_search_by(|probe| {
|
||||
match (
|
||||
buf.get(&probe).map(|n| n.message.as_ref()).unwrap_or(None),
|
||||
buf.get(&child).map(|n| n.message.as_ref()).unwrap_or(None),
|
||||
) {
|
||||
(Some(p), Some(c)) => {
|
||||
#[cfg(feature = "unicode_algorithms")]
|
||||
{
|
||||
envelopes[c]
|
||||
.subject()
|
||||
.split_graphemes()
|
||||
.cmp(&envelopes[p].subject().split_graphemes())
|
||||
}
|
||||
#[cfg(not(feature = "unicode_algorithms"))]
|
||||
{
|
||||
envelopes[c].subject().cmp(&envelopes[p].subject())
|
||||
}
|
||||
}
|
||||
(Some(_), None) => Ordering::Less,
|
||||
(None, Some(_)) => Ordering::Greater,
|
||||
(None, None) => Ordering::Equal,
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -622,16 +550,14 @@ impl Threads {
|
|||
let was_unseen = self.thread_nodes[&thread_hash].unseen;
|
||||
let is_unseen = !envelopes.read().unwrap()[&new_hash].is_seen();
|
||||
if was_unseen != is_unseen {
|
||||
if let Thread { ref mut unseen, .. } =
|
||||
self.thread_ref_mut(self.thread_nodes[&thread_hash].group)
|
||||
{
|
||||
let Thread { ref mut unseen, .. } =
|
||||
self.thread_ref_mut(self.thread_nodes[&thread_hash].group);
|
||||
if was_unseen {
|
||||
*unseen -= 1;
|
||||
} else {
|
||||
*unseen += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.thread_nodes.get_mut(&thread_hash).unwrap().unseen = is_unseen;
|
||||
self.hash_set.remove(&old_hash);
|
||||
self.hash_set.insert(new_hash);
|
||||
|
|
|
@ -195,7 +195,7 @@ pub trait MailListingTrait: ListingTrait {
|
|||
|
||||
fn row_updates(&mut self) -> &mut SmallVec<[ThreadHash; 8]>;
|
||||
fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]>;
|
||||
fn redraw_list(&mut self, context: &Context, items: Box<dyn Iterator<Item = ThreadHash>>) {
|
||||
fn redraw_list(&mut self, _context: &Context, _items: Box<dyn Iterator<Item = ThreadHash>>) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,9 +82,9 @@ impl MailListingTrait for CompactListing {
|
|||
&mut self.row_updates
|
||||
}
|
||||
|
||||
fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
let is_selection_empty = self.selection.values().cloned().any(std::convert::identity);
|
||||
let i = [self.get_thread_under_cursor(self.cursor_pos.2, context)];
|
||||
let i = [self.get_thread_under_cursor(self.cursor_pos.2)];
|
||||
let cursor_iter;
|
||||
let sel_iter = if is_selection_empty {
|
||||
cursor_iter = None;
|
||||
|
@ -120,7 +120,7 @@ impl ListingTrait for CompactListing {
|
|||
if self.length == 0 {
|
||||
return;
|
||||
}
|
||||
let thread_hash = self.get_thread_under_cursor(idx, context);
|
||||
let thread_hash = self.get_thread_under_cursor(idx);
|
||||
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let threads = &account.collection.threads[&self.folder_hash];
|
||||
|
@ -344,7 +344,7 @@ impl ListingTrait for CompactListing {
|
|||
|
||||
for r in 0..cmp::min(self.length - top_idx, rows) {
|
||||
let (fg_color, bg_color) = {
|
||||
let thread_hash = self.get_thread_under_cursor(r + top_idx, context);
|
||||
let thread_hash = self.get_thread_under_cursor(r + top_idx);
|
||||
|
||||
let c = &self.data_columns.columns[0][(0, r + top_idx)];
|
||||
if self.selection[&thread_hash] {
|
||||
|
@ -682,7 +682,7 @@ impl CompactListing {
|
|||
if old_cursor_pos == self.new_cursor_pos {
|
||||
self.view.update(context);
|
||||
} else if self.unfocused {
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
|
||||
self.view = ThreadView::new(self.new_cursor_pos, thread, None, context);
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ impl CompactListing {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadHash {
|
||||
fn get_thread_under_cursor(&self, cursor: usize) -> ThreadHash {
|
||||
if self.filter_term.is_empty() {
|
||||
*self
|
||||
.order
|
||||
|
@ -1183,7 +1183,7 @@ impl Component for CompactListing {
|
|||
k == shortcuts[CompactListing::DESCRIPTION]["open_thread"]
|
||||
) =>
|
||||
{
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
self.view = ThreadView::new(self.cursor_pos, thread, None, context);
|
||||
self.unfocused = true;
|
||||
self.dirty = true;
|
||||
|
@ -1209,7 +1209,7 @@ impl Component for CompactListing {
|
|||
key == shortcuts[CompactListing::DESCRIPTION]["select_entry"]
|
||||
) =>
|
||||
{
|
||||
let thread_hash = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread_hash = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
self.selection.entry(thread_hash).and_modify(|e| *e = !*e);
|
||||
}
|
||||
UIEvent::Action(ref action) => {
|
||||
|
@ -1232,7 +1232,7 @@ impl Component for CompactListing {
|
|||
return true;
|
||||
}
|
||||
Action::ToggleThreadSnooze if !self.unfocused => {
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
let account = &mut context.accounts[self.cursor_pos.0];
|
||||
account
|
||||
.collection
|
||||
|
|
|
@ -61,9 +61,9 @@ impl MailListingTrait for ConversationsListing {
|
|||
&mut self.row_updates
|
||||
}
|
||||
|
||||
fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
let is_selection_empty = self.selection.values().cloned().any(std::convert::identity);
|
||||
let i = [self.get_thread_under_cursor(self.cursor_pos.2, context)];
|
||||
let i = [self.get_thread_under_cursor(self.cursor_pos.2)];
|
||||
let cursor_iter;
|
||||
let sel_iter = if is_selection_empty {
|
||||
cursor_iter = None;
|
||||
|
@ -99,7 +99,7 @@ impl ListingTrait for ConversationsListing {
|
|||
if self.length == 0 {
|
||||
return;
|
||||
}
|
||||
let thread_hash = self.get_thread_under_cursor(idx, context);
|
||||
let thread_hash = self.get_thread_under_cursor(idx);
|
||||
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let threads = &account.collection.threads[&self.folder_hash];
|
||||
|
@ -610,7 +610,7 @@ impl ConversationsListing {
|
|||
if old_cursor_pos == self.new_cursor_pos {
|
||||
self.view.update(context);
|
||||
} else if self.unfocused {
|
||||
let thread_group = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread_group = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
|
||||
self.view = ThreadView::new(self.new_cursor_pos, thread_group, None, context);
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ impl ConversationsListing {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadHash {
|
||||
fn get_thread_under_cursor(&self, cursor: usize) -> ThreadHash {
|
||||
if self.filter_term.is_empty() {
|
||||
*self
|
||||
.order
|
||||
|
@ -866,7 +866,6 @@ impl ConversationsListing {
|
|||
panic!();
|
||||
})
|
||||
.0
|
||||
//threads.root_set(cursor)
|
||||
} else {
|
||||
self.filtered_selection[cursor]
|
||||
}
|
||||
|
@ -1120,7 +1119,7 @@ impl Component for ConversationsListing {
|
|||
k == shortcuts[ConversationsListing::DESCRIPTION]["open_thread"]
|
||||
) =>
|
||||
{
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
self.view = ThreadView::new(self.cursor_pos, thread, None, context);
|
||||
self.unfocused = true;
|
||||
self.dirty = true;
|
||||
|
@ -1146,7 +1145,7 @@ impl Component for ConversationsListing {
|
|||
key == shortcuts[ConversationsListing::DESCRIPTION]["select_entry"]
|
||||
) =>
|
||||
{
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
self.selection.entry(thread).and_modify(|e| *e = !*e);
|
||||
return true;
|
||||
}
|
||||
|
@ -1205,7 +1204,7 @@ impl Component for ConversationsListing {
|
|||
return true;
|
||||
}
|
||||
Action::ToggleThreadSnooze if !self.unfocused => {
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2, context);
|
||||
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
|
||||
let account = &mut context.accounts[self.cursor_pos.0];
|
||||
account
|
||||
.collection
|
||||
|
|
|
@ -83,7 +83,7 @@ impl MailListingTrait for PlainListing {
|
|||
&mut self._row_updates
|
||||
}
|
||||
|
||||
fn get_focused_items(&self, context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
fn get_focused_items(&self, _context: &Context) -> SmallVec<[ThreadHash; 8]> {
|
||||
return SmallVec::new();
|
||||
/*
|
||||
let is_selection_empty = self.selection.values().cloned().any(std::convert::identity);
|
||||
|
@ -890,12 +890,6 @@ impl PlainListing {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_thread_under_cursor(&self, cursor: usize, context: &Context) -> ThreadNodeHash {
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let env_hash = self.get_env_under_cursor(cursor, context);
|
||||
account.collection.get_env(env_hash).thread()
|
||||
}
|
||||
|
||||
fn format_date(envelope: &Envelope) -> String {
|
||||
let d = std::time::UNIX_EPOCH + std::time::Duration::from_secs(envelope.date());
|
||||
let now: std::time::Duration = std::time::SystemTime::now()
|
||||
|
|
|
@ -457,11 +457,10 @@ impl Component for AccountStatus {
|
|||
((1, line), (width - 1, height - 1)),
|
||||
None,
|
||||
);
|
||||
for (i, f) in a
|
||||
for f in a
|
||||
.ref_folders
|
||||
.values()
|
||||
.filter(|f| f.special_usage() != SpecialUsageMailbox::Normal)
|
||||
.enumerate()
|
||||
{
|
||||
line += 1;
|
||||
write_string_to_grid(
|
||||
|
|
|
@ -834,6 +834,7 @@ impl StatusBar {
|
|||
change_colors(grid, area, Color::Byte(123), Color::Byte(26));
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
||||
fn draw_execute_bar(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
clear_area(grid, area);
|
||||
let (x, y) = write_string_to_grid(
|
||||
|
|
|
@ -302,9 +302,6 @@ impl BackendOp for PluginOp {
|
|||
debug!(channel.expect_ack())?;
|
||||
let bytes: Result<PluginResult<String>> = channel.from_read();
|
||||
self.bytes = Some(bytes.map(Into::into).and_then(std::convert::identity)?);
|
||||
if let Some(ref bytes) = self.bytes {
|
||||
debug!(Envelope::from_bytes(bytes.as_bytes(), None));
|
||||
}
|
||||
Ok(self.bytes.as_ref().map(String::as_bytes).unwrap())
|
||||
} else {
|
||||
Err(MeliError::new("busy"))
|
||||
|
|
Loading…
Reference in New Issue