summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2018-07-24 20:20:32 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-06-10 19:40:25 +0300
commitb7729243adddfdd5781afe6c059092eb2c80db50 (patch)
tree5a7a462f0e8f323cb21c0026b85bc4d452e36f7e /ui
parent569e710067965cf0a718378fcb7c8169d0c20251 (diff)
Fix compiler warnings
Diffstat (limited to 'ui')
-rw-r--r--ui/src/cells.rs2
-rw-r--r--ui/src/components/mail/listing.rs1
-rw-r--r--ui/src/components/mail/view.rs18
-rw-r--r--ui/src/components/mod.rs10
-rw-r--r--ui/src/components/utilities.rs11
-rw-r--r--ui/src/execute/mod.rs4
-rw-r--r--ui/src/helpers.rs4
-rw-r--r--ui/src/lib.rs12
8 files changed, 29 insertions, 33 deletions
diff --git a/ui/src/cells.rs b/ui/src/cells.rs
index 172c690b..d17e9ed8 100644
--- a/ui/src/cells.rs
+++ b/ui/src/cells.rs
@@ -181,7 +181,7 @@ impl fmt::Display for CellBuffer {
'_y: for y in 0..self.rows {
'_x: for x in 0..self.cols {
let c: &char = &self[(x,y)].ch();
- write!(f, "{}", *c);
+ write!(f, "{}", *c).unwrap();
if *c == '\n' {
continue '_y;
}
diff --git a/ui/src/components/mail/listing.rs b/ui/src/components/mail/listing.rs
index 9046c720..b04a51ef 100644
--- a/ui/src/components/mail/listing.rs
+++ b/ui/src/components/mail/listing.rs
@@ -526,7 +526,6 @@ impl Component for MailListing {
},
- _ => { unreachable!() },
}
},
_ => {
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs
index 2d601003..0015faa0 100644
--- a/ui/src/components/mail/view.rs
+++ b/ui/src/components/mail/view.rs
@@ -7,8 +7,8 @@ use std::process::{Command, Stdio};
enum ViewMode {
Normal,
Url,
- Attachment,
- Raw,
+ // Attachment,
+ // Raw,
}
/// Contains an Envelope view, with sticky headers, a pager for the body, and subviews for more
@@ -140,11 +140,10 @@ impl Component for MailView {
match self.mode {
ViewMode::Url => {
// URL indexes must be colored (ugh..)
- let (cols, _) = buf.size();
let lines: Vec<&str> = text.split('\n').collect();
let mut shift = 0;
- for (ridx, r) in lines.iter().enumerate() {
- for (lidx, l) in finder.links(&r).enumerate() {
+ for r in lines.iter() {
+ for l in finder.links(&r) {
buf[(l.start() + shift - 1, 0)].set_fg(Color::Byte(226));
buf[(l.start() + shift - 2, 0)].set_fg(Color::Byte(226));
buf[(l.start() + shift - 3, 0)].set_fg(Color::Byte(226));
@@ -184,7 +183,7 @@ impl Component for MailView {
self.cmd_buf.clear();
- let url = {
+ {
let threaded = context.accounts[self.coordinates.0].runtime_settings.threaded;
let mailbox = &mut context.accounts[self.coordinates.0][self.coordinates.1].as_ref().unwrap().as_ref().unwrap();
let envelope_idx: usize = if threaded {
@@ -195,7 +194,8 @@ impl Component for MailView {
let envelope: &Envelope = &mailbox.collection[envelope_idx];
if let Some(u) = envelope.body().attachments().get(lidx) {
- eprintln!("{:?}", u);
+ let p = create_temp_file(&decode(u), None);
+ eprintln!("{:?}", p);
} else {
context.replies.push_back(UIEvent { id: 0, event_type: UIEventType::StatusNotification(format!("Attachment `{}` not found.", lidx)) });
@@ -231,7 +231,7 @@ impl Component for MailView {
};
- let open_url = Command::new("xdg-open")
+ Command::new("xdg-open")
.arg(url)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
@@ -243,7 +243,7 @@ impl Component for MailView {
match self.mode {
ViewMode::Normal => { self.mode = ViewMode::Url },
ViewMode::Url => { self.mode = ViewMode::Normal },
- _ => {},
+ //_ => {},
}
self.dirty = true;
},
diff --git a/ui/src/components/mod.rs b/ui/src/components/mod.rs
index 56eddbf5..10aa37e1 100644
--- a/ui/src/components/mod.rs
+++ b/ui/src/components/mod.rs
@@ -43,17 +43,17 @@ const HORZ_BOUNDARY: char = '─';
const VERT_BOUNDARY: char = '│';
/// The top-left corner
-const TOP_LEFT_CORNER: char = '┌';
+const _TOP_LEFT_CORNER: char = '┌';
/// The top-right corner
-const TOP_RIGHT_CORNER: char = '┐';
+const _TOP_RIGHT_CORNER: char = '┐';
/// The bottom-left corner
-const BOTTOM_LEFT_CORNER: char = '└';
+const _BOTTOM_LEFT_CORNER: char = '└';
/// The bottom-right corner
-const BOTTOM_RIGHT_CORNER: char = '┘';
+const _BOTTOM_RIGHT_CORNER: char = '┘';
const LIGHT_VERTICAL_AND_RIGHT: char = '├';
-const LIGHT_VERTICAL_AND_LEFT: char = '┤';
+const _LIGHT_VERTICAL_AND_LEFT: char = '┤';
const LIGHT_DOWN_AND_HORIZONTAL: char = '┬';
diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs
index d448d8e1..6bfd1605 100644
--- a/ui/src/components/utilities.rs
+++ b/ui/src/components/utilities.rs
@@ -2,9 +2,6 @@
*/
use super::*;
-use melib::mailbox::email::interpret_format_flowed;
-use melib::mailbox::email::Attachment;
-
/// A horizontally split in half container.
pub struct HSplit {
top: Entity,
@@ -428,22 +425,22 @@ impl Component for StatusBar {
// A box with a text content.
pub struct TextBox {
- content: String,
+ _content: String,
}
impl TextBox {
pub fn new(s: String) -> Self {
TextBox {
- content: s,
+ _content: s,
}
}
}
impl Component for TextBox {
- fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
+ fn draw(&mut self, _grid: &mut CellBuffer, _area: Area, _context: &mut Context) {
}
- fn process_event(&mut self, event: &UIEvent, context: &mut Context) {
+ fn process_event(&mut self, _event: &UIEvent, _context: &mut Context) {
return;
}
}
diff --git a/ui/src/execute/mod.rs b/ui/src/execute/mod.rs
index 9b481f43..c0e4a722 100644
--- a/ui/src/execute/mod.rs
+++ b/ui/src/execute/mod.rs
@@ -1,7 +1,7 @@
/*! A parser module for user commands passed through the Ex mode.
*/
use std;
-use nom::{digit, alpha};
+use nom::{digit, };
named!(usize_c<usize>,
@@ -12,7 +12,9 @@ named!(pub goto<usize>,
call!(usize_c))
);
+/*
named!(pub sort<&str>,
preceded!(tag!("sort "),
map_res!(call!(alpha), std::str::from_utf8))
);
+ */
diff --git a/ui/src/helpers.rs b/ui/src/helpers.rs
index a276178c..83bb3fa9 100644
--- a/ui/src/helpers.rs
+++ b/ui/src/helpers.rs
@@ -1,10 +1,7 @@
use std;
use std::path::PathBuf;
use std::io::Write;
-use std::ops::{Deref, DerefMut};
-
-use std::fs;
use uuid::Uuid;
#[derive(Debug)]
@@ -37,6 +34,7 @@ pub fn create_temp_file(bytes: &[u8], filename: Option<&PathBuf>) -> File {
};
let mut f = std::fs::File::create(path).unwrap();
+
f.write(bytes).unwrap();
f.flush().unwrap();
File {
diff --git a/ui/src/lib.rs b/ui/src/lib.rs
index f470fc67..a96f9f71 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -141,10 +141,10 @@ impl fmt::Display for UIMode {
/// An event notification that is passed to Entities for handling.
pub struct Notification {
- title: String,
- content: String,
+ _title: String,
+ _content: String,
- timestamp: std::time::Instant,
+ _timestamp: std::time::Instant,
}
/// A context container for loaded settings, accounts, UI changes, etc.
@@ -158,7 +158,7 @@ pub struct Context {
/// Events queue that components send back to the state
replies: VecDeque<UIEvent>,
- backends: Backends,
+ _backends: Backends,
input_thread: chan::Sender<bool>,
}
@@ -225,7 +225,7 @@ impl State<std::io::Stdout> {
context: Context {
accounts: accounts,
- backends: backends,
+ _backends: backends,
settings: settings.clone(),
runtime_settings: settings,
dirty_areas: VecDeque::with_capacity(5),
@@ -381,7 +381,7 @@ impl<W: Write> State<W> {
in_pipe.write(&buf).unwrap();
std::fs::remove_file(file.path()).unwrap();
}
- let output = output.wait_with_output().expect("Failed to read stdout");
+ output.wait_with_output().expect("Failed to read stdout");
return;
},