Making the basic example more readable

This commit is contained in:
Matt McCoy 2016-06-24 20:40:56 -04:00
parent a87c58bf91
commit 964d7c99ef

View file

@ -6,14 +6,9 @@ use imap::client::Client;
use imap::mailbox::Mailbox;
fn main() {
let mut imap_socket = match Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()) {
Ok(s) => s,
Err(e) => panic!("{}", e)
};
let mut imap_socket = Client::secure_connect(("imap.gmail.com", 993), SslContext::new(SslMethod::Sslv23).unwrap()).unwrap();
if let Err(e) = imap_socket.login("username", "password") {
println!("Error: {}", e)
};
imap_socket.login("username", "password").unwrap();
match imap_socket.capability() {
Ok(capabilities) => {
@ -40,7 +35,5 @@ fn main() {
Err(_) => println!("Error Fetching email 2")
};
if let Err(e) = imap_socket.logout() {
println!("Error: {}", e)
};
imap_socket.logout().unwrap();
}