(nit) Cargo fmt

This commit is contained in:
Bryce Fisher-Fleig 2019-09-17 20:14:29 -07:00
parent beb41d2f52
commit e3123476f5

View file

@ -1,16 +1,11 @@
extern crate imap; extern crate imap;
extern crate rustls_connector; extern crate rustls_connector;
use std::{ use std::{env, error::Error, net::TcpStream};
env,
error::Error,
net::TcpStream,
};
use dotenv::dotenv; use dotenv::dotenv;
use rustls_connector::RustlsConnector; use rustls_connector::RustlsConnector;
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
// Read config from environment or .env file // Read config from environment or .env file
dotenv().ok(); dotenv().ok();
@ -26,7 +21,12 @@ fn main() -> Result<(), Box<dyn Error>> {
Ok(()) Ok(())
} }
fn fetch_inbox_top(host: String, user: String, password: String, port: u16) -> Result<Option<String>, Box<dyn Error>> { fn fetch_inbox_top(
host: String,
user: String,
password: String,
port: u16,
) -> Result<Option<String>, Box<dyn Error>> {
// Setup Rustls TcpStream // Setup Rustls TcpStream
let stream = TcpStream::connect((host.as_ref(), port))?; let stream = TcpStream::connect((host.as_ref(), port))?;
let tls = RustlsConnector::default(); let tls = RustlsConnector::default();
@ -38,9 +38,7 @@ fn fetch_inbox_top(host: String, user: String, password: String, port: u16) -> R
// the client we have here is unauthenticated. // the client we have here is unauthenticated.
// to do anything useful with the e-mails, we need to log in // to do anything useful with the e-mails, we need to log in
let mut imap_session = client let mut imap_session = client.login(&user, &password).map_err(|e| e.0)?;
.login(&user, &password)
.map_err(|e| e.0)?;
// we want to fetch the first email in the INBOX mailbox // we want to fetch the first email in the INBOX mailbox
imap_session.select("INBOX")?; imap_session.select("INBOX")?;