From 07a51de0b6f44cfb495bd5e65a000b67b6afbb10 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 11 Feb 2019 14:55:29 +0200 Subject: [PATCH] Fix unused warnings --- melib/src/mailbox/backends/maildir/backend.rs | 3 --- melib/src/mailbox/collection.rs | 10 ++++------ melib/src/mailbox/thread.rs | 2 +- ui/src/components/indexer/index.rs | 15 +++------------ ui/src/components/indexer/mod.rs | 5 +++-- ui/src/components/mail/listing/thread.rs | 17 ++++++++--------- ui/src/conf/accounts.rs | 2 ++ 7 files changed, 21 insertions(+), 33 deletions(-) diff --git a/melib/src/mailbox/backends/maildir/backend.rs b/melib/src/mailbox/backends/maildir/backend.rs index ab8f840e3..54db6baa5 100644 --- a/melib/src/mailbox/backends/maildir/backend.rs +++ b/melib/src/mailbox/backends/maildir/backend.rs @@ -422,7 +422,6 @@ impl MaildirType { let name = name.clone(); let root_path = root_path.clone(); let map = map.clone(); - let map2 = map.clone(); let tx = tx.clone(); let cache_dir = cache_dir.clone(); let path = path.clone(); @@ -540,8 +539,6 @@ impl MaildirType { let mut result = t.join(); ret.append(&mut result); } - let mut map = map2.lock().unwrap(); - let map = map.entry(folder_hash).or_default(); Ok(ret) }; let result = thunk(); diff --git a/melib/src/mailbox/collection.rs b/melib/src/mailbox/collection.rs index a78278804..7b73e9174 100644 --- a/melib/src/mailbox/collection.rs +++ b/melib/src/mailbox/collection.rs @@ -6,11 +6,9 @@ use std::collections::BTreeMap; use std::fs; use std::io; use std::ops::{Deref, DerefMut}; -use std::result; extern crate fnv; use self::fnv::FnvHashMap; -use self::fnv::FnvHashSet; /// `Mailbox` represents a folder of mail. #[derive(Debug, Clone, Default)] @@ -51,16 +49,16 @@ impl Collection { let date_index = BTreeMap::new(); let subject_index = None; - let cache_dir = - xdg::BaseDirectories::with_profile("meli", format!("{}_Thread", folder.hash())) - .unwrap(); /* Scrap caching for now. When a cached threads file is loaded, we must remove/rehash the * thread nodes that shouldn't exist anymore (e.g. because their file moved from /new to * /cur, or it was deleted). */ let threads = Threads::new(&mut envelopes); - /*if let Some(cached) = cache_dir.find_cache_file("threads") { + /*let cache_dir = + xdg::BaseDirectories::with_profile("meli", format!("{}_Thread", folder.hash())) + .unwrap(); + if let Some(cached) = cache_dir.find_cache_file("threads") { let reader = io::BufReader::new(fs::File::open(cached).unwrap()); let result: result::Result = bincode::deserialize_from(reader); let ret = if let Ok(mut cached_t) = result { diff --git a/melib/src/mailbox/thread.rs b/melib/src/mailbox/thread.rs index 991b8aab2..9b6baf0ab 100644 --- a/melib/src/mailbox/thread.rs +++ b/melib/src/mailbox/thread.rs @@ -627,7 +627,7 @@ impl Threads { let mut subject_table: FnvHashMap, (bool, usize)> = FnvHashMap::with_capacity_and_hasher(collection.len(), Default::default()); - for (i, &r) in root_set.iter().enumerate() { + for &r in root_set.iter() { /* "Find the subject of that sub-tree": */ let (mut subject, mut is_re): (_, bool) = if self.thread_nodes[r].message.is_some() { /* "If there is a message in the Container, the subject is the subject of that diff --git a/ui/src/components/indexer/index.rs b/ui/src/components/indexer/index.rs index 3faed023c..15c5a0349 100644 --- a/ui/src/components/indexer/index.rs +++ b/ui/src/components/indexer/index.rs @@ -1,5 +1,4 @@ use super::*; -use components::utilities::PageMovement; pub trait IndexContent: Component { /* Handles the drawing of one entry */ @@ -16,10 +15,10 @@ pub trait IndexContent: Component { #[derive(Debug, PartialEq)] enum IndexState { - Uninitialized, + //Uninitialized, Listing, Unfocused, - Search, + //Search, } #[derive(Debug)] @@ -58,14 +57,6 @@ impl Component for Index { } match self.state { - IndexState::Uninitialized => { - self.content.refresh(context); - - /* copy area */ - self.state = IndexState::Listing; - self.draw(grid, area, context); - return; - } IndexState::Listing => { /* rehighlight entries, redraw pages */ let upper_left = upper_left!(area); @@ -125,7 +116,7 @@ impl Component for Index { IndexState::Unfocused => { self.content.draw(grid, area, context); } - IndexState::Search => unreachable!(), + //IndexState::Search => unreachable!(), } self.dirty = false; diff --git a/ui/src/components/indexer/mod.rs b/ui/src/components/indexer/mod.rs index 078685bd6..eb804bae0 100644 --- a/ui/src/components/indexer/mod.rs +++ b/ui/src/components/indexer/mod.rs @@ -58,7 +58,8 @@ impl Default for Indexer { } impl Indexer { - fn draw_menu(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {} + fn draw_menu(&mut self, _grid: &mut CellBuffer, _area: Area, _context: &mut Context) { + } } impl Component for Indexer { @@ -104,7 +105,7 @@ impl Component for Indexer { } match event.event_type { - UIEventType::RefreshMailbox(c) => { + UIEventType::RefreshMailbox(_) => { self.dirty = true; } UIEventType::ChangeMode(UIMode::Normal) => { diff --git a/ui/src/components/mail/listing/thread.rs b/ui/src/components/mail/listing/thread.rs index 60255f3d8..fea28b190 100644 --- a/ui/src/components/mail/listing/thread.rs +++ b/ui/src/components/mail/listing/thread.rs @@ -530,21 +530,20 @@ impl Component for ThreadListing { } return; } - { - let account = &context.accounts[self.cursor_pos.0]; - let mailbox = &account[self.cursor_pos.1].as_ref().unwrap(); - let coordinates = ( - self.cursor_pos.0, - self.cursor_pos.1, - self.locations[self.cursor_pos.2], + + let coordinates = ( + self.cursor_pos.0, + self.cursor_pos.1, + self.locations[self.cursor_pos.2], ); - self.view = Some(MailView::new(coordinates, None, None)); - } + + self.view = Some(MailView::new(coordinates, None, None)); self.view.as_mut().unwrap().draw( grid, (set_y(upper_left, mid + 1), bottom_right), context, ); + self.dirty = false; } } diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs index 3ab572d20..a0598f920 100644 --- a/ui/src/conf/accounts.rs +++ b/ui/src/conf/accounts.rs @@ -193,6 +193,7 @@ impl Account { */ } + /* fn add_replies_to_folder(&mut self, folder_index: usize) { if let Some(sent_index) = self.sent_folder.as_ref() { if self.folders[*sent_index] @@ -226,6 +227,7 @@ impl Account { } } } + */ pub fn status(&mut self, index: usize) -> result::Result<(), usize> { match self.workers[index].as_mut() {