summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-09 11:54:47 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-15 13:21:14 +0300
commitecb3fd7f3d5bab2a6f0f7592d2f45928d90fdf56 (patch)
tree8565f9c9306a9c042b4e43bf5f804a578b86cadb
parentd1d11356db1b3ec261857fc33eb3073c0da097e4 (diff)
Add dyn keyword to Trait objects
And fix some unused var warnings as well
-rw-r--r--melib/src/backends.rs27
-rw-r--r--melib/src/backends/imap.rs4
-rw-r--r--melib/src/backends/imap/watch.rs7
-rw-r--r--melib/src/backends/maildir/backend.rs4
-rw-r--r--melib/src/backends/mbox.rs6
-rw-r--r--melib/src/email.rs14
-rw-r--r--melib/src/email/attachments.rs2
-rw-r--r--melib/src/email/compose.rs2
-rw-r--r--melib/src/email/parser.rs2
-rw-r--r--melib/src/thread.rs3
-rw-r--r--ui/src/components/contacts/contact_list.rs2
-rw-r--r--ui/src/components/indexer/index.rs3
-rw-r--r--ui/src/components/mail/listing/compact.rs6
-rw-r--r--ui/src/components/mail/listing/thread.rs8
-rw-r--r--ui/src/components/mail/view.rs4
-rw-r--r--ui/src/components/mail/view/envelope.rs4
-rw-r--r--ui/src/components/utilities.rs26
-rw-r--r--ui/src/components/utilities/widgets.rs2
-rw-r--r--ui/src/conf/accounts.rs4
-rw-r--r--ui/src/execute/actions.rs2
-rw-r--r--ui/src/state.rs6
21 files changed, 62 insertions, 76 deletions
diff --git a/melib/src/backends.rs b/melib/src/backends.rs
index 94863652..fe7ee1a4 100644
--- a/melib/src/backends.rs
+++ b/melib/src/backends.rs
@@ -37,12 +37,13 @@ use std::ops::Deref;
use fnv::FnvHashMap;
use std;
-pub type BackendCreator = Box<Fn(&AccountSettings, Box<Fn(&str) -> bool>) -> Box<MailBackend>>;
+pub type BackendCreator =
+ Box<dyn Fn(&AccountSettings, Box<dyn Fn(&str) -> bool>) -> Box<dyn MailBackend>>;
/// A hashmap containing all available mail backends.
/// An abstraction over any available backends.
pub struct Backends {
- map: FnvHashMap<std::string::String, Box<Fn() -> BackendCreator>>,
+ map: FnvHashMap<std::string::String, Box<dyn Fn() -> BackendCreator>>,
}
impl Default for Backends {
@@ -78,7 +79,7 @@ impl Backends {
self.map[key]()
}
- pub fn register(&mut self, key: String, backend: Box<Fn() -> BackendCreator>) {
+ pub fn register(&mut self, key: String, backend: Box<dyn Fn() -> BackendCreator>) {
if self.map.contains_key(&key) {
panic!("{} is an already registered backend", key);
}
@@ -116,9 +117,9 @@ impl RefreshEvent {
/// A `RefreshEventConsumer` is a boxed closure that must be used to consume a `RefreshEvent` and
/// send it to a UI provided channel. We need this level of abstraction to provide an interface for
/// all users of mailbox refresh events.
-pub struct RefreshEventConsumer(Box<Fn(RefreshEvent) -> () + Send + Sync>);
+pub struct RefreshEventConsumer(Box<dyn Fn(RefreshEvent) -> () + Send + Sync>);
impl RefreshEventConsumer {
- pub fn new(b: Box<Fn(RefreshEvent) -> () + Send + Sync>) -> Self {
+ pub fn new(b: Box<dyn Fn(RefreshEvent) -> () + Send + Sync>) -> Self {
RefreshEventConsumer(b)
}
pub fn send(&self, r: RefreshEvent) {
@@ -126,7 +127,7 @@ impl RefreshEventConsumer {
}
}
-pub struct NotifyFn(Box<Fn(FolderHash) -> () + Send + Sync>);
+pub struct NotifyFn(Box<dyn Fn(FolderHash) -> () + Send + Sync>);
impl fmt::Debug for NotifyFn {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -134,14 +135,14 @@ impl fmt::Debug for NotifyFn {
}
}
-impl From<Box<Fn(FolderHash) -> () + Send + Sync>> for NotifyFn {
- fn from(kind: Box<Fn(FolderHash) -> () + Send + Sync>) -> Self {
+impl From<Box<dyn Fn(FolderHash) -> () + Send + Sync>> for NotifyFn {
+ fn from(kind: Box<dyn Fn(FolderHash) -> () + Send + Sync>) -> Self {
NotifyFn(kind)
}
}
impl NotifyFn {
- pub fn new(b: Box<Fn(FolderHash) -> () + Send + Sync>) -> Self {
+ pub fn new(b: Box<dyn Fn(FolderHash) -> () + Send + Sync>) -> Self {
NotifyFn(b)
}
pub fn notify(&self, f: FolderHash) {
@@ -164,10 +165,10 @@ pub trait MailBackend: ::std::fmt::Debug {
fn get(&mut self, folder: &Folder) -> Async<Result<Vec<Envelope>>>;
fn watch(&self, sender: RefreshEventConsumer) -> Result<()>;
fn folders(&self) -> FnvHashMap<FolderHash, Folder>;
- fn operation(&self, hash: EnvelopeHash, folder_hash: FolderHash) -> Box<BackendOp>;
+ fn operation(&self, hash: EnvelopeHash, folder_hash: FolderHash) -> Box<dyn BackendOp>;
fn save(&self, bytes: &[u8], folder: &str, flags: Option<Flag>) -> Result<()>;
- fn folder_operation(&mut self, path: &str, op: FolderOperation) -> Result<()> {
+ fn folder_operation(&mut self, _path: &str, _op: FolderOperation) -> Result<()> {
Ok(())
}
}
@@ -234,11 +235,11 @@ pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send {
/// Seen flag when fetching an envelope)
#[derive(Debug)]
pub struct ReadOnlyOp {
- op: Box<BackendOp>,
+ op: Box<dyn BackendOp>,
}
impl ReadOnlyOp {
- pub fn new(op: Box<BackendOp>) -> Box<BackendOp> {
+ pub fn new(op: Box<dyn BackendOp>) -> Box<dyn BackendOp> {
Box::new(ReadOnlyOp { op })
}
}
diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs
index 99a51d71..d68ff490 100644
--- a/melib/src/backends/imap.rs
+++ b/melib/src/backends/imap.rs
@@ -245,7 +245,7 @@ impl MailBackend for ImapType {
.collect()
}
- fn operation(&self, hash: EnvelopeHash, _folder_hash: FolderHash) -> Box<BackendOp> {
+ fn operation(&self, hash: EnvelopeHash, _folder_hash: FolderHash) -> Box<dyn BackendOp> {
let (uid, folder_hash) = self.hash_index.lock().unwrap()[&hash];
Box::new(ImapOp::new(
uid,
@@ -400,7 +400,7 @@ macro_rules! exit_on_error {
}
}
impl ImapType {
- pub fn new(s: &AccountSettings, is_subscribed: Box<Fn(&str) -> bool>) -> Self {
+ pub fn new(s: &AccountSettings, is_subscribed: Box<dyn Fn(&str) -> bool>) -> Self {
use std::io::prelude::*;
use std::net::TcpStream;
debug!(s);
diff --git a/melib/src/backends/imap/watch.rs b/melib/src/backends/imap/watch.rs
index 8528549f..7819be07 100644
--- a/melib/src/backends/imap/watch.rs
+++ b/melib/src/backends/imap/watch.rs
@@ -57,7 +57,7 @@ pub fn poll_with_examine(kit: ImapWatchKit) {
let mut response = String::with_capacity(8 * 1024);
loop {
std::thread::sleep(std::time::Duration::from_millis(5 * 60 * 1000));
- for (hash, folder) in &folders {
+ for folder in folders.values() {
examine_updates(folder, &sender, &mut conn, &hash_index, &uid_index);
}
let mut main_conn = main_conn.lock().unwrap();
@@ -318,11 +318,6 @@ pub fn idle(kit: ImapWatchKit) {
}
}
}
- debug!("failure");
- sender.send(RefreshEvent {
- hash: folder_hash,
- kind: RefreshEventKind::Failure(MeliError::new("conn_error")),
- });
}
fn examine_updates(
diff --git a/melib/src/backends/maildir/backend.rs b/melib/src/backends/maildir/backend.rs
index 9a7b50e7..46b51eec 100644
--- a/melib/src/backends/maildir/backend.rs
+++ b/melib/src/backends/maildir/backend.rs
@@ -460,7 +460,7 @@ impl MailBackend for MaildirType {
Ok(())
}
- fn operation(&self, hash: EnvelopeHash, folder_hash: FolderHash) -> Box<BackendOp> {
+ fn operation(&self, hash: EnvelopeHash, folder_hash: FolderHash) -> Box<dyn BackendOp> {
Box::new(MaildirOp::new(hash, self.hash_indexes.clone(), folder_hash))
}
@@ -529,7 +529,7 @@ impl MailBackend for MaildirType {
}
impl MaildirType {
- pub fn new(settings: &AccountSettings, is_subscribed: Box<Fn(&str) -> bool>) -> Self {
+ pub fn new(settings: &AccountSettings, is_subscribed: Box<dyn Fn(&str) -> bool>) -> Self {
let mut folders: FnvHashMap<FolderHash, MaildirFolder> = Default::default();
fn recurse_folders<P: AsRef<Path>>(
folders: &mut FnvHashMap<FolderHash, MaildirFolder>,
diff --git a/melib/src/backends/mbox.rs b/melib/src/backends/mbox.rs
index 84b7a4b4..51d6231f 100644
--- a/melib/src/backends/mbox.rs
+++ b/melib/src/backends/mbox.rs
@@ -242,7 +242,7 @@ impl BackendOp for MboxOp {
flags
}
- fn set_flag(&mut self, envelope: &mut Envelope, flag: Flag) -> Result<()> {
+ fn set_flag(&mut self, _envelope: &mut Envelope, _flag: Flag) -> Result<()> {
Ok(())
}
}
@@ -526,7 +526,7 @@ impl MailBackend for MboxType {
.map(|(h, f)| (*h, f.clone() as Folder))
.collect()
}
- fn operation(&self, hash: EnvelopeHash, _folder_hash: FolderHash) -> Box<BackendOp> {
+ fn operation(&self, hash: EnvelopeHash, _folder_hash: FolderHash) -> Box<dyn BackendOp> {
let (offset, length) = {
let index = self.index.lock().unwrap();
index[&hash]
@@ -540,7 +540,7 @@ impl MailBackend for MboxType {
}
impl MboxType {
- pub fn new(s: &AccountSettings, _is_subscribed: Box<Fn(&str) -> bool>) -> Self {
+ pub fn new(s: &AccountSettings, _is_subscribed: Box<dyn Fn(&str) -> bool>) -> Self {
let path = Path::new(s.root_folder.as_str());
if !path.exists() {
panic!(
diff --git a/melib/src/email.rs b/melib/src/email.rs
index 4bfba2ca..1775cb5e 100644
--- a/melib/src/email.rs
+++ b/melib/src/email.rs
@@ -387,7 +387,7 @@ impl Envelope {
}
Err(MeliError::new("Couldn't parse mail."))
}
- pub fn from_token(mut operation: Box<BackendOp>, hash: EnvelopeHash) -> Option<Envelope> {
+ pub fn from_token(mut operation: Box<dyn BackendOp>, hash: EnvelopeHash) -> Option<Envelope> {
let mut e = Envelope::new(hash);
e.flags = operation.fetch_flags();
if let Ok(bytes) = operation.as_bytes() {
@@ -522,7 +522,7 @@ impl Envelope {
Ok(())
}
- pub fn populate_headers_from_token(&mut self, mut operation: Box<BackendOp>) -> Result<()> {
+ pub fn populate_headers_from_token(&mut self, mut operation: Box<dyn BackendOp>) -> Result<()> {
let headers = operation.fetch_headers()?;
self.populate_headers(headers)
}
@@ -563,7 +563,7 @@ impl Envelope {
let _strings: Vec<String> = self.to.iter().map(|a| format!("{}", a)).collect();
_strings.join(", ")
}
- pub fn bytes(&self, mut operation: Box<BackendOp>) -> Vec<u8> {
+ pub fn bytes(&self, mut operation: Box<dyn BackendOp>) -> Vec<u8> {
operation
.as_bytes()
.map(|v| v.into())
@@ -608,7 +608,7 @@ impl Envelope {
})
})
}
- pub fn body(&self, mut operation: Box<BackendOp>) -> Attachment {
+ pub fn body(&self, mut operation: Box<dyn BackendOp>) -> Attachment {
debug!("searching body for {:?}", self.message_id_display());
let file = operation.as_bytes();
self.body_bytes(file.unwrap())
@@ -781,7 +781,7 @@ impl Envelope {
pub fn set_datetime(&mut self, new_val: chrono::DateTime<chrono::FixedOffset>) {
self.timestamp = new_val.timestamp() as UnixTimestamp;
}
- pub fn set_flag(&mut self, f: Flag, mut operation: Box<BackendOp>) -> Result<()> {
+ pub fn set_flag(&mut self, f: Flag, mut operation: Box<dyn BackendOp>) -> Result<()> {
self.flags.toggle(f);
operation.set_flag(self, f)?;
Ok(())
@@ -792,14 +792,14 @@ impl Envelope {
pub fn flags(&self) -> Flag {
self.flags
}
- pub fn set_seen(&mut self, operation: Box<BackendOp>) -> Result<()> {
+ pub fn set_seen(&mut self, operation: Box<dyn BackendOp>) -> Result<()> {
if !self.flags.contains(Flag::SEEN) {
self.set_flag(Flag::SEEN, operation)
} else {
Ok(())
}
}
- pub fn set_unseen(&mut self, operation: Box<BackendOp>) -> Result<()> {
+ pub fn set_unseen(&mut self, operation: Box<dyn BackendOp>) -> Result<()> {
if self.flags.contains(Flag::SEEN) {
self.set_flag(Flag::SEEN, operation)
} else {
diff --git a/melib/src/email/attachments.rs b/melib/src/email/attachments.rs
index 04fec24c..bea56b18 100644
--- a/melib/src/email/attachments.rs
+++ b/melib/src/email/attachments.rs
@@ -441,7 +441,7 @@ fn decode_rfc822(_raw: &[u8]) -> Attachment {
builder.build()
}
-type Filter<'a> = Box<FnMut(&'a Attachment, &mut Vec<u8>) -> () + 'a>;
+type Filter<'a> = Box<dyn FnMut(&'a Attachment, &mut Vec<u8>) -> () + 'a>;
fn decode_rec_helper<'a>(a: &'a Attachment, filter: &mut Option<Filter<'a>>) -> Vec<u8> {
match a.content_type {
diff --git a/melib/src/email/compose.rs b/melib/src/email/compose.rs
index b9d915e6..26ca3219 100644
--- a/melib/src/email/compose.rs
+++ b/melib/src/email/compose.rs
@@ -113,7 +113,7 @@ impl str::FromStr for Draft {
}
impl Draft {
- pub fn edit(envelope: &Envelope, mut op: Box<BackendOp>) -> Self {
+ pub fn edit(envelope: &Envelope, mut op: Box<dyn BackendOp>) -> Self {
let mut ret = Draft::default();
//TODO: Inform user if error
{
diff --git a/melib/src/email/parser.rs b/melib/src/email/parser.rs
index 89ea8d4a..28a3c940 100644
--- a/melib/src/email/parser.rs
+++ b/melib/src/email/parser.rs
@@ -247,7 +247,7 @@ pub fn headers_raw(input: &[u8]) -> IResult<&[u8], &[u8]> {
if input.is_empty() {
return IResult::Incomplete(Needed::Unknown);
}
- for (i, x) in input.iter().enumerate() {
+ for i in 0..input.len() {
if input[i..].starts_with(b"\n\n") {
return IResult::Done(&input[(i + 1)..], &input[0..=i]);
} else if input[i..].starts_with(b"\r\n\r\n") {
diff --git a/melib/src/thread.rs b/melib/src/thread.rs
index b0c5d8f6..9e76879d 100644
--- a/melib/src/thread.rs
+++ b/melib/src/thread.rs
@@ -1107,6 +1107,7 @@ impl Threads {
}
}
+ /*
fn link_envelope(&mut self, envelope: &mut Envelope) {
let t_idx: ThreadHash = {
let m_id = envelope.message_id().raw();
@@ -1215,7 +1216,7 @@ impl Threads {
}
ref_ptr = parent_id;
}
- }
+ }*/
fn tree_insert_root(&mut self, new_id: ThreadHash, envelopes: &Envelopes) {
debug_assert!(
diff --git a/ui/src/components/contacts/contact_list.rs b/ui/src/components/contacts/contact_list.rs
index 3807bc12..a718ef0f 100644
--- a/ui/src/components/contacts/contact_list.rs
+++ b/ui/src/components/contacts/contact_list.rs
@@ -22,7 +22,7 @@ pub struct ContactList {
mode: ViewMode,
dirty: bool,
- view: Option<Box<Component>>,
+ view: Option<Box<dyn Component>>,
id: ComponentId,
}
diff --git a/ui/src/components/indexer/index.rs b/ui/src/components/indexer/index.rs
index 0472e67a..585b3703 100644
--- a/ui/src/components/indexer/index.rs
+++ b/ui/src/components/indexer/index.rs
@@ -33,7 +33,7 @@ pub struct Index {
dirty: bool,
state: IndexState,
- content: Box<IndexContent>,
+ content: Box<dyn IndexContent>,
id: ComponentId,
}
@@ -117,7 +117,6 @@ impl Component for Index {
IndexState::Unfocused => {
self.content.draw(grid, area, context);
}
- //IndexState::Search => unreachable!(),
}
self.dirty = false;
diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs
index 72a7a1fa..c557e1d7 100644
--- a/ui/src/components/mail/listing/compact.rs
+++ b/ui/src/components/mail/listing/compact.rs
@@ -112,11 +112,6 @@ impl ListingTrait for CompactListing {
return;
}
let i = self.get_envelope_under_cursor(idx, context);
- let account = &context.accounts[self.cursor_pos.0];
- let is_seen = {
- let root_envelope: &Envelope = &account.get_env(&i);
- root_envelope.is_seen()
- };
let fg_color = self.data_columns.columns[0][(0, idx)].fg();
let bg_color = if self.cursor_pos.2 == idx {
@@ -128,7 +123,6 @@ impl ListingTrait for CompactListing {
};
let (upper_left, bottom_right) = area;
- let (width, height) = self.data_columns.columns[3].size();
change_colors(grid, area, fg_color, bg_color);
let mut x = get_x(upper_left)
+ self.data_columns.widths[0]
diff --git a/ui/src/components/mail/listing/thread.rs b/ui/src/components/mail/listing/thread.rs
index e9fb9d29..6a1169e2 100644
--- a/ui/src/components/mail/listing/thread.rs
+++ b/ui/src/components/mail/listing/thread.rs
@@ -502,12 +502,8 @@ impl Component for ThreadListing {
false
} else {
let account = &mut context.accounts[self.cursor_pos.0];
- let (hash, is_seen) = {
- let envelope: &Envelope =
- &account.get_env(&self.locations[self.cursor_pos.2]);
- (envelope.hash(), envelope.is_seen())
- };
- is_seen
+ let envelope: &Envelope = &account.get_env(&self.locations[self.cursor_pos.2]);
+ envelope.is_seen()
}
};
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs
index 0e7a24be..a8cc3d80 100644
--- a/ui/src/components/mail/view.rs
+++ b/ui/src/components/mail/view.rs
@@ -68,7 +68,7 @@ impl ViewMode {
pub struct MailView {
coordinates: (usize, usize, EnvelopeHash),
pager: Option<Pager>,
- subview: Option<Box<Component>>,
+ subview: Option<Box<dyn Component>>,
dirty: bool,
mode: ViewMode,
expand_headers: bool,
@@ -89,7 +89,7 @@ impl MailView {
pub fn new(
coordinates: (usize, usize, EnvelopeHash),
pager: Option<Pager>,
- subview: Option<Box<Component>>,
+ subview: Option<Box<dyn Component>>,
) -> Self {
MailView {
coordinates,
diff --git a/ui/src/components/mail/view/envelope.rs b/ui/src/components/mail/view/envelope.rs
index 3cb4a516..58e49a6d 100644
--- a/ui/src/components/mail/view/envelope.rs
+++ b/ui/src/components/mail/view/envelope.rs
@@ -48,7 +48,7 @@ impl ViewMode {
#[derive(Debug)]
pub struct EnvelopeView {
pager: Option<Pager>,
- subview: Option<Box<Component>>,
+ subview: Option<Box<dyn Component>>,
dirty: bool,
mode: ViewMode,
wrapper: EnvelopeWrapper,
@@ -69,7 +69,7 @@ impl EnvelopeView {
pub fn new(
wrapper: EnvelopeWrapper,
pager: Option<Pager>,
- subview: Option<Box<Component>>,
+ subview: Option<Box<dyn Component>>,
account_pos: usize,
) -> Self {
EnvelopeView {
diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs
index b150627a..d1eb7409 100644
--- a/ui/src/components/utilities.rs
+++ b/ui/src/components/utilities.rs
@@ -30,8 +30,8 @@ pub use self::widgets::*;
/// A horizontally split in half container.
#[derive(Debug)]
pub struct HSplit {
- top: Box<Component>,
- bottom: Box<Component>,
+ top: Box<dyn Component>,
+ bottom: Box<dyn Component>,
show_divider: bool,
ratio: usize, // bottom/whole height * 100
id: ComponentId,
@@ -46,8 +46,8 @@ impl fmt::Display for HSplit {
impl HSplit {
pub fn new(
- top: Box<Component>,
- bottom: Box<Component>,
+ top: Box<dyn Component>,
+ bottom: Box<dyn Component>,
ratio: usize,
show_divider: bool,
) -> Self {
@@ -125,8 +125,8 @@ impl Component for HSplit {
/// A vertically split in half container.
#[derive(Debug)]
pub struct VSplit {
- left: Box<Component>,
- right: Box<Component>,
+ left: Box<dyn Component>,
+ right: Box<dyn Component>,
show_divider: bool,
prev_visibility: (bool, bool),
/// This is the width of the right container to the entire width.
@@ -143,8 +143,8 @@ impl fmt::Display for VSplit {
impl VSplit {
pub fn new(
- left: Box<Component>,
- right: Box<Component>,
+ left: Box<dyn Component>,
+ right: Box<dyn Component>,
ratio: usize,
show_divider: bool,
) -> Self {
@@ -602,7 +602,7 @@ impl Component for Pager {
/// Status bar.
#[derive(Debug)]
pub struct StatusBar {
- container: Box<Component>,
+ container: Box<dyn Component>,
status: String,
notifications: VecDeque<String>,
ex_buffer: Field,
@@ -624,7 +624,7 @@ impl fmt::Display for StatusBar {
}
impl StatusBar {
- pub fn new(container: Box<Component>) -> Self {
+ pub fn new(container: Box<dyn Component>) -> Self {
StatusBar {
container,
status: String::with_capacity(256),
@@ -1120,7 +1120,7 @@ impl Component for Progress {
#[derive(Debug)]
pub struct Tabbed {
pinned: usize,
- children: Vec<Box<Component>>,
+ children: Vec<Box<dyn Component>>,
cursor_pos: usize,
show_shortcuts: bool,
@@ -1130,7 +1130,7 @@ pub struct Tabbed {
}
impl Tabbed {
- pub fn new(children: Vec<Box<Component>>) -> Self {
+ pub fn new(children: Vec<Box<dyn Component>>) -> Self {
let pinned = children.len();
Tabbed {
pinned,
@@ -1194,7 +1194,7 @@ impl Tabbed {
context.dirty_areas.push_back(area);
}
- pub fn add_component(&mut self, new: Box<Component>) {
+ pub fn add_component(&mut self, new: Box<dyn Component>) {
self.children.push(new);
}
}
diff --git a/ui/src/components/utilities/widgets.rs b/ui/src/components/utilities/widgets.rs
index b84f0ea2..387fd906 100644
--- a/ui/src/components/utilities/widgets.rs
+++ b/ui/src/components/utilities/widgets.rs
@@ -1,7 +1,7 @@
use super::*;
use fnv::FnvHashMap;
-type AutoCompleteFn = Box<Fn(&Context, &str) -> Vec<AutoCompleteEntry> + Send>;
+type AutoCompleteFn = Box<dyn Fn(&Context, &str) -> Vec<AutoCompleteEntry> + Send>;
#[derive(Debug, PartialEq)]
enum FormFocus {
diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs
index 4f84f8eb..3a0525ba 100644
--- a/ui/src/conf/accounts.rs
+++ b/ui/src/conf/accounts.rs
@@ -317,7 +317,7 @@ impl Account {
}
fn new_worker(
folder: Folder,
- backend: &mut Box<MailBackend>,
+ backend: &mut Box<dyn MailBackend>,
notify_fn: Arc<NotifyFn>,
) -> Worker {
let mailbox_handle = backend.get(&folder);
@@ -617,7 +617,7 @@ impl Account {
pub fn contains_key(&self, h: EnvelopeHash) -> bool {
self.collection.contains_key(&h)
}
- pub fn operation(&self, h: EnvelopeHash) -> Box<BackendOp> {
+ pub fn operation(&self, h: EnvelopeHash) -> Box<dyn BackendOp> {
for mailbox in self.folders.values() {
match mailbox {
MailboxEntry::Available(ref m) | MailboxEntry::Parsing(ref m, _, _) => {
diff --git a/ui/src/execute/actions.rs b/ui/src/execute/actions.rs
index ec62db90..02074bef 100644
--- a/ui/src/execute/actions.rs
+++ b/ui/src/execute/actions.rs
@@ -45,7 +45,7 @@ pub enum ListingAction {
#[derive(Debug)]
pub enum TabAction {
- New(Option<Box<Component>>),
+ New(Option<Box<dyn Component>>),
NewDraft(usize, Option<Draft>),
Reply((usize, usize, usize), ThreadHash), // thread coordinates (account, mailbox, root_set idx) and thread hash
Close,
diff --git a/ui/src/state.rs b/ui/src/state.rs
index 9fd5ae47..27084608 100644
--- a/ui/src/state.rs
+++ b/ui/src/state.rs
@@ -21,7 +21,7 @@
/*! The application's state.
-The UI crate has an Box<Component>-Component-System design. The System part, is also the application's state, so they're both merged in the `State` struct.
+The UI crate has an Box<dyn Component>-Component-System design. The System part, is also the application's state, so they're both merged in the `State` struct.
`State` owns all the Components of the UI. In the application's main event loop, input is handed to the state in the form of `UIEvent` objects which traverse the component graph. Components decide to handle each input or not.
@@ -128,7 +128,7 @@ pub struct State {
stdout: Option<StateStdout>,
child: Option<ForkType>,
pub mode: UIMode,
- components: Vec<Box<Component>>,
+ components: Vec<Box<dyn Component>>,
pub context: Context,
threads: FnvHashMap<thread::ThreadId, (chan::Sender<bool>, thread::JoinHandle<()>)>,
work_controller: WorkController,
@@ -477,7 +477,7 @@ impl State {
);
}
}
- pub fn register_component(&mut self, component: Box<Component>) {
+ pub fn register_component(&mut self, component: Box<dyn Component>) {
self.components.push(component);
}
/// Convert user commands to actions/method calls.