Remove unused variables/functions
parent
0ee3a0bf79
commit
99fbac3806
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::backends::MailboxHash;
|
use crate::backends::MailboxHash;
|
||||||
use core::ops::{Index, IndexMut};
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||||
|
@ -490,7 +489,6 @@ impl Collection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub struct RwRef<'g, K: std::cmp::Eq + std::hash::Hash, V> {
|
pub struct RwRef<'g, K: std::cmp::Eq + std::hash::Hash, V> {
|
||||||
guard: RwLockReadGuard<'g, HashMap<K, V>>,
|
guard: RwLockReadGuard<'g, HashMap<K, V>>,
|
||||||
hash: K,
|
hash: K,
|
||||||
|
|
|
@ -24,8 +24,6 @@ use crate::melib::text_processing::TextProcessing;
|
||||||
use melib::CardId;
|
use melib::CardId;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
const MAX_COLS: usize = 500;
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum ViewMode {
|
enum ViewMode {
|
||||||
List,
|
List,
|
||||||
|
@ -220,7 +218,7 @@ impl ContactList {
|
||||||
self.theme_default.fg,
|
self.theme_default.fg,
|
||||||
self.theme_default.bg,
|
self.theme_default.bg,
|
||||||
self.theme_default.attrs,
|
self.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len() - 1, 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,8 +27,6 @@ use std::cmp;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
|
|
||||||
const MAX_COLS: usize = 500;
|
|
||||||
|
|
||||||
macro_rules! address_list {
|
macro_rules! address_list {
|
||||||
(($name:expr) as comma_sep_list) => {{
|
(($name:expr) as comma_sep_list) => {{
|
||||||
let mut ret: String =
|
let mut ret: String =
|
||||||
|
@ -240,7 +238,7 @@ impl MailListingTrait for CompactListing {
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len() - 1, 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -435,7 +433,7 @@ impl MailListingTrait for CompactListing {
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len() - 1, 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1337,13 +1335,10 @@ impl CompactListing {
|
||||||
"Encountered an error while searching for `{}`: {}.",
|
"Encountered an error while searching for `{}`: {}.",
|
||||||
search_term, err
|
search_term, err
|
||||||
);
|
);
|
||||||
log(
|
log(message.clone(), ERROR);
|
||||||
format!("Failed to search for term {}: {}", search_term, err),
|
|
||||||
ERROR,
|
|
||||||
);
|
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
Some("Could not perform search".to_string()),
|
Some("Could not perform search".to_string()),
|
||||||
err.to_string(),
|
message,
|
||||||
Some(crate::types::NotificationType::ERROR),
|
Some(crate::types::NotificationType::ERROR),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ use crate::jobs::{oneshot, JobId, JoinHandle};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
|
|
||||||
const MAX_COLS: usize = 500;
|
|
||||||
|
|
||||||
macro_rules! address_list {
|
macro_rules! address_list {
|
||||||
(($name:expr) as comma_sep_list) => {{
|
(($name:expr) as comma_sep_list) => {{
|
||||||
let mut ret: String =
|
let mut ret: String =
|
||||||
|
@ -163,7 +161,7 @@ impl MailListingTrait for PlainListing {
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len().saturating_sub(1), 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -982,7 +980,7 @@ impl PlainListing {
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len() - 1, 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1296,10 +1294,9 @@ impl Component for PlainListing {
|
||||||
let (chan, handle, job_id) = context.accounts[self.cursor_pos.0]
|
let (chan, handle, job_id) = context.accounts[self.cursor_pos.0]
|
||||||
.job_executor
|
.job_executor
|
||||||
.spawn_specialized(job);
|
.spawn_specialized(job);
|
||||||
context.accounts[self.cursor_pos.0].active_jobs.insert(
|
context.accounts[self.cursor_pos.0]
|
||||||
job_id,
|
.active_jobs
|
||||||
crate::conf::accounts::JobRequest::Search(handle),
|
.insert(job_id, crate::conf::accounts::JobRequest::Search(handle));
|
||||||
);
|
|
||||||
self.search_job = Some((filter_term.to_string(), chan, job_id));
|
self.search_job = Some((filter_term.to_string(), chan, job_id));
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -24,8 +24,6 @@ use crate::components::utilities::PageMovement;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
const MAX_COLS: usize = 500;
|
|
||||||
|
|
||||||
/// A list of all mail (`Envelope`s) in a `Mailbox`. On `\n` it opens the `Envelope` content in a
|
/// A list of all mail (`Envelope`s) in a `Mailbox`. On `\n` it opens the `Envelope` content in a
|
||||||
/// `MailView`.
|
/// `MailView`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -106,18 +104,18 @@ impl MailListingTrait for ThreadListing {
|
||||||
};
|
};
|
||||||
let message: String =
|
let message: String =
|
||||||
context.accounts[self.cursor_pos.0][&self.cursor_pos.1].status();
|
context.accounts[self.cursor_pos.0][&self.cursor_pos.1].status();
|
||||||
|
self.data_columns.columns[0] =
|
||||||
|
CellBuffer::new_with_context(message.len(), 1, default_cell, context);
|
||||||
self.length = 0;
|
self.length = 0;
|
||||||
/*
|
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
message.as_str(),
|
message.as_str(),
|
||||||
&mut self.content,
|
&mut self.data_columns.columns[0],
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (MAX_COLS - 1, 0)),
|
((0, 0), (message.len().saturating_sub(1), 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,18 +153,17 @@ impl MailListingTrait for ThreadListing {
|
||||||
};
|
};
|
||||||
if threads.len() == 0 {
|
if threads.len() == 0 {
|
||||||
let message = format!("Mailbox `{}` is empty.", account[&self.cursor_pos.1].name());
|
let message = format!("Mailbox `{}` is empty.", account[&self.cursor_pos.1].name());
|
||||||
/*
|
self.data_columns.columns[0] =
|
||||||
self.content = CellBuffer::new_with_context(message.len(), 1, default_cell, context);
|
CellBuffer::new_with_context(message.len(), 1, default_cell, context);
|
||||||
write_string_to_grid(
|
write_string_to_grid(
|
||||||
&message,
|
message.as_str(),
|
||||||
&mut self.content,
|
&mut self.data_columns.columns[0],
|
||||||
self.color_cache.theme_default.fg,
|
self.color_cache.theme_default.fg,
|
||||||
self.color_cache.theme_default.bg,
|
self.color_cache.theme_default.bg,
|
||||||
self.color_cache.theme_default.attrs,
|
self.color_cache.theme_default.attrs,
|
||||||
((0, 0), (message.len() - 1, 0)),
|
((0, 0), (message.len() - 1, 0)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mut rows = Vec::with_capacity(1024);
|
let mut rows = Vec::with_capacity(1024);
|
||||||
|
@ -186,9 +183,6 @@ impl MailListingTrait for ThreadListing {
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut indentations: Vec<bool> = Vec::with_capacity(6);
|
let mut indentations: Vec<bool> = Vec::with_capacity(6);
|
||||||
let mut thread_idx = 0; // needed for alternate thread colors
|
|
||||||
/* Draw threaded view. */
|
|
||||||
|
|
||||||
let roots = items
|
let roots = items
|
||||||
.filter_map(|r| threads.groups[&r].root().map(|r| r.root))
|
.filter_map(|r| threads.groups[&r].root().map(|r| r.root))
|
||||||
.collect::<_>();
|
.collect::<_>();
|
||||||
|
@ -200,9 +194,6 @@ impl MailListingTrait for ThreadListing {
|
||||||
while let Some((indentation, thread_node_hash, has_sibling)) = iter.next() {
|
while let Some((indentation, thread_node_hash, has_sibling)) = iter.next() {
|
||||||
let thread_node = &thread_nodes[&thread_node_hash];
|
let thread_node = &thread_nodes[&thread_node_hash];
|
||||||
|
|
||||||
if indentation == 0 {
|
|
||||||
thread_idx += 1;
|
|
||||||
}
|
|
||||||
if thread_node.has_message() {
|
if thread_node.has_message() {
|
||||||
let envelope: EnvelopeRef =
|
let envelope: EnvelopeRef =
|
||||||
account.collection.get_env(thread_node.message().unwrap());
|
account.collection.get_env(thread_node.message().unwrap());
|
||||||
|
@ -225,7 +216,6 @@ impl MailListingTrait for ThreadListing {
|
||||||
let mut entry_strings = self.make_entry_string(&envelope, context);
|
let mut entry_strings = self.make_entry_string(&envelope, context);
|
||||||
entry_strings.subject = SubjectString(ThreadListing::make_thread_entry(
|
entry_strings.subject = SubjectString(ThreadListing::make_thread_entry(
|
||||||
&envelope,
|
&envelope,
|
||||||
idx,
|
|
||||||
indentation,
|
indentation,
|
||||||
thread_node_hash,
|
thread_node_hash,
|
||||||
&threads,
|
&threads,
|
||||||
|
@ -693,7 +683,9 @@ impl ThreadListing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_line_self(&mut self, idx: usize, context: &Context) {
|
fn highlight_line_self(&mut self, _idx: usize, _context: &Context) {
|
||||||
|
/*
|
||||||
|
* FIXME
|
||||||
if self.length == 0 {
|
if self.length == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -703,23 +695,11 @@ impl ThreadListing {
|
||||||
.collection
|
.collection
|
||||||
.get_env(env_hash);
|
.get_env(env_hash);
|
||||||
|
|
||||||
let fg_color = if !envelope.is_seen() {
|
*/
|
||||||
Color::Byte(0)
|
|
||||||
} else {
|
|
||||||
Color::Default
|
|
||||||
};
|
|
||||||
let bg_color = if !envelope.is_seen() {
|
|
||||||
Color::Byte(251)
|
|
||||||
} else if idx % 2 == 0 {
|
|
||||||
Color::Byte(236)
|
|
||||||
} else {
|
|
||||||
Color::Default
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_thread_entry(
|
fn make_thread_entry(
|
||||||
envelope: &Envelope,
|
envelope: &Envelope,
|
||||||
idx: usize,
|
|
||||||
indent: usize,
|
indent: usize,
|
||||||
node_idx: ThreadNodeHash,
|
node_idx: ThreadNodeHash,
|
||||||
threads: &Threads,
|
threads: &Threads,
|
||||||
|
@ -779,21 +759,6 @@ impl ThreadListing {
|
||||||
.0
|
.0
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
|
||||||
.duration_since(d)
|
|
||||||
.unwrap_or_else(|_| std::time::Duration::new(std::u64::MAX, 0));
|
|
||||||
match now.as_secs() {
|
|
||||||
n if n < 10 * 60 * 60 => format!("{} hours ago{}", n / (60 * 60), " ".repeat(8)),
|
|
||||||
n if n < 24 * 60 * 60 => format!("{} hours ago{}", n / (60 * 60), " ".repeat(7)),
|
|
||||||
n if n < 4 * 24 * 60 * 60 => {
|
|
||||||
format!("{} days ago{}", n / (24 * 60 * 60), " ".repeat(9))
|
|
||||||
}
|
|
||||||
_ => melib::datetime::timestamp_to_string(envelope.datetime(), None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn make_entry_string(&self, e: &Envelope, context: &Context) -> EntryStrings {
|
fn make_entry_string(&self, e: &Envelope, context: &Context) -> EntryStrings {
|
||||||
let mut tags = String::new();
|
let mut tags = String::new();
|
||||||
let mut colors: SmallVec<[_; 8]> = SmallVec::new();
|
let mut colors: SmallVec<[_; 8]> = SmallVec::new();
|
||||||
|
@ -855,7 +820,6 @@ impl ThreadListing {
|
||||||
self.data_columns.columns[3].size().0,
|
self.data_columns.columns[3].size().0,
|
||||||
self.data_columns.columns[4].size().0,
|
self.data_columns.columns[4].size().0,
|
||||||
);
|
);
|
||||||
let account = &context.accounts[self.cursor_pos.0];
|
|
||||||
|
|
||||||
for ((idx, is_seen, has_attachments, env_hash), strings) in
|
for ((idx, is_seen, has_attachments, env_hash), strings) in
|
||||||
self.rows.iter().skip(start).take(end - start + 1)
|
self.rows.iter().skip(start).take(end - start + 1)
|
||||||
|
|
|
@ -33,7 +33,7 @@ use melib::backends::{
|
||||||
use melib::email::*;
|
use melib::email::*;
|
||||||
use melib::error::{MeliError, Result};
|
use melib::error::{MeliError, Result};
|
||||||
use melib::text_processing::GlobMatch;
|
use melib::text_processing::GlobMatch;
|
||||||
use melib::thread::{SortField, SortOrder, ThreadNode, ThreadNodeHash, Threads};
|
use melib::thread::{SortField, SortOrder, Threads};
|
||||||
use melib::AddressBook;
|
use melib::AddressBook;
|
||||||
use melib::Collection;
|
use melib::Collection;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl MailBackend for PluginBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fetch(&mut self, mailbox_hash: MailboxHash) -> Result<Async<Result<Vec<Envelope>>>> {
|
fn fetch(&mut self, _mailbox_hash: MailboxHash) -> Result<Async<Result<Vec<Envelope>>>> {
|
||||||
let mut w = AsyncBuilder::new();
|
let mut w = AsyncBuilder::new();
|
||||||
let channel = self.channel.clone();
|
let channel = self.channel.clone();
|
||||||
let handle = {
|
let handle = {
|
||||||
|
|
Loading…
Reference in New Issue