From d11c0f0a6dc76ff4db086c6660891484c51c4f18 Mon Sep 17 00:00:00 2001 From: dvkt Date: Thu, 26 Dec 2019 15:53:51 -0800 Subject: [PATCH] 2018 style imports --- src/config.rs | 8 ++++---- src/gopher.rs | 12 +++++++----- src/help.rs | 3 +-- src/main.rs | 3 +-- src/menu.rs | 11 +++++------ src/ui.rs | 35 +++++++++++++++++------------------ 6 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/config.rs b/src/config.rs index bd28d67..6281f64 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,8 +1,8 @@ use crate::gopher; - -use std::fs::{File, OpenOptions}; -use std::io::prelude::*; -use std::io::{BufReader, Result, Write}; +use std::{ + fs::{File, OpenOptions}, + io::{prelude::*, BufReader, Result, Write}, +}; pub const DIR: &str = "~/.config/phetch/"; diff --git a/src/gopher.rs b/src/gopher.rs index 4483e95..97afd5e 100644 --- a/src/gopher.rs +++ b/src/gopher.rs @@ -1,8 +1,10 @@ -use std::io::{Read, Result, Write}; -use std::net::TcpStream; -use std::net::ToSocketAddrs; -use std::os::unix::fs::OpenOptionsExt; -use std::time::Duration; +use std::{ + io::{Read, Result, Write}, + net::TcpStream, + net::ToSocketAddrs, + os::unix::fs::OpenOptionsExt, + time::Duration, +}; use termion::input::TermRead; // Some Gopher servers can be kind of slow, we may want to up this or diff --git a/src/help.rs b/src/help.rs index 541e551..6d6e258 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,5 +1,4 @@ -use crate::bookmarks; -use crate::history; +use crate::{bookmarks, history}; pub fn lookup(name: &str) -> Option { Some(match name { diff --git a/src/main.rs b/src/main.rs index 663f406..8ec2015 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ extern crate phetch; -use phetch::gopher; -use phetch::ui::UI; +use phetch::{gopher, ui::UI}; use std::process::exit; fn main() { diff --git a/src/menu.rs b/src/menu.rs index bf5755e..53327e7 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -1,10 +1,9 @@ -use crate::gopher; -use crate::gopher::Type; +use crate::gopher::{self, Type}; use crate::ui::{Action, Key, View, MAX_COLS, SCROLL_LINES}; -use std::fmt; -use std::io::stdout; -use std::io::Write; -use termion::color; +use std::{ + fmt, + io::{stdout, Write}, +}; pub struct Menu { pub url: String, // gopher url diff --git a/src/ui.rs b/src/ui.rs index 5e5edf7..5de5d31 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -3,24 +3,23 @@ mod view; pub use self::action::Action; pub use self::view::View; -use crate::bookmarks; -use crate::gopher; -use crate::gopher::Type; -use crate::help; -use crate::history; -use crate::menu::Menu; -use crate::text::Text; -use crate::utils; -use std::io::{stdin, stdout, Result, Write}; -use std::process; -use std::process::Stdio; -use std::sync::mpsc; -use std::thread; -use std::time::Duration; -use termion::color; -use termion::input::TermRead; -use termion::raw::IntoRawMode; -use termion::terminal_size; +use crate::{ + bookmarks, + gopher::{self, Type}, + help, history, + menu::Menu, + text::Text, + utils, +}; +use std::{ + io::{stdin, stdout, Result, Write}, + process, + process::Stdio, + sync::mpsc, + thread, + time::Duration, +}; +use termion::{color, input::TermRead, raw::IntoRawMode, terminal_size}; pub type Key = termion::event::Key; pub type Page = Box;