diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-05 20:45:04 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-05 20:45:04 -0400 |
commit | ebf8e5c674322a0fe85339e57b0f6a80e51087d3 (patch) | |
tree | 0c061ac6554f4f0a19c867a74d1fdfc975377711 /src | |
parent | 4c194de5c7e940e1eaf71c0fb4b455ba6547c880 (diff) |
cargo fmt
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/file_operations.rs | 11 | ||||
-rw-r--r-- | src/commands/open_file.rs | 26 | ||||
-rw-r--r-- | src/config/keymap.rs | 8 | ||||
-rw-r--r-- | src/config/preview.rs | 1 | ||||
-rw-r--r-- | src/history.rs | 10 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/preview.rs | 60 | ||||
-rw-r--r-- | src/ui.rs | 12 |
8 files changed, 66 insertions, 66 deletions
diff --git a/src/commands/file_operations.rs b/src/commands/file_operations.rs index a8dd5d7..cb5a818 100644 --- a/src/commands/file_operations.rs +++ b/src/commands/file_operations.rs @@ -311,9 +311,10 @@ fn fs_cut_thread( fs_extra::dir::TransitProcessResult::ContinueOrAbort }; - if let Err(e) = fs_extra::move_items_with_progress(&cpath, &destination, &options, handle) { - let err = - std::io::Error::new(std::io::ErrorKind::Other, format!("{}", e)); + if let Err(e) = + fs_extra::move_items_with_progress(&cpath, &destination, &options, handle) + { + let err = std::io::Error::new(std::io::ErrorKind::Other, format!("{}", e)); return Err(err); } std::fs::remove_dir_all(&path)?; @@ -377,7 +378,9 @@ fn fs_copy_thread( fs_extra::dir::TransitProcessResult::ContinueOrAbort }; - if let Err(e) = fs_extra::copy_items_with_progress(&path, &destination, &options, handle) { + if let Err(e) = + fs_extra::copy_items_with_progress(&path, &destination, &options, handle) + { let err = std::io::Error::new(std::io::ErrorKind::Other, format!("{}", e)); return Err(err); } diff --git a/src/commands/open_file.rs b/src/commands/open_file.rs index b606330..c9f689d 100644 --- a/src/commands/open_file.rs +++ b/src/commands/open_file.rs @@ -34,25 +34,25 @@ impl OpenFile { mimetype_options.extend(ext_entries); } } -/* + /* match tree_magic::from_filepath(&path) { None => {}, Some(mimetype) => { /* mime subtype have second priority */ - if let Some(s) = MIMETYPE_T.mimetype.get(&mimetype) { - mimetype_options.extend(s.iter()); - } + if let Some(s) = MIMETYPE_T.mimetype.get(&mimetype) { + mimetype_options.extend(s.iter()); + } - /* generic mime type have last priority */ - if let Some(s) = mimetype.find('/') { - let mimetype_type = &mimetype[..s]; - if let Some(s) = MIMETYPE_T.mimetype.get(mimetype_type) { - mimetype_options.extend(s.iter()); - } - } - } + /* generic mime type have last priority */ + if let Some(s) = mimetype.find('/') { + let mimetype_type = &mimetype[..s]; + if let Some(s) = MIMETYPE_T.mimetype.get(mimetype_type) { + mimetype_options.extend(s.iter()); + } + } + } } -*/ + */ mimetype_options } diff --git a/src/config/keymap.rs b/src/config/keymap.rs index 9b3c6a9..72bba86 100644 --- a/src/config/keymap.rs +++ b/src/config/keymap.rs @@ -2,8 +2,8 @@ use serde_derive::Deserialize; use std::collections::{hash_map::Entry, HashMap}; use std::process::exit; -use crate::commands::{self, CommandKeybind, JoshutoCommand}; use super::{parse_config_file, ConfigStructure, Flattenable}; +use crate::commands::{self, CommandKeybind, JoshutoCommand}; use crate::KEYMAP_FILE; pub const BACKSPACE: i32 = 0x7F; @@ -52,11 +52,7 @@ impl ConfigStructure for JoshutoKeymap { } } -fn insert_keycommand( - map: &mut JoshutoKeymap, - keycommand: Box<JoshutoCommand>, - keys: &[i32], -) { +fn insert_keycommand(map: &mut JoshutoKeymap, keycommand: Box<JoshutoCommand>, keys: &[i32]) { match keys.len() { 0 => {} 1 => match map.entry(keys[0]) { diff --git a/src/config/preview.rs b/src/config/preview.rs index dd6665d..9f52a71 100644 --- a/src/config/preview.rs +++ b/src/config/preview.rs @@ -58,4 +58,3 @@ impl std::default::Default for JoshutoPreview { } } } - diff --git a/src/history.rs b/src/history.rs index b5e04ae..d746c30 100644 --- a/src/history.rs +++ b/src/history.rs @@ -73,11 +73,11 @@ impl DirectoryHistory for HashMap<PathBuf, JoshutoDirList> { ) -> Result<&mut JoshutoDirList, std::io::Error> { match self.entry(path.to_path_buf().clone()) { Entry::Occupied(entry) => { -/* - if dir_entry.need_update() { - dir_entry.update_contents(&sort_option)?; - } -*/ + /* + if dir_entry.need_update() { + dir_entry.update_contents(&sort_option)?; + } + */ Ok(entry.into_mut()) } Entry::Vacant(entry) => { diff --git a/src/main.rs b/src/main.rs index 6afe6b3..b4df990 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,9 @@ use lazy_static::lazy_static; use std::path::PathBuf; use structopt::StructOpt; -use config::{ConfigStructure, JoshutoConfig, JoshutoKeymap, JoshutoMimetype, JoshutoPreview, JoshutoTheme}; +use config::{ + ConfigStructure, JoshutoConfig, JoshutoKeymap, JoshutoMimetype, JoshutoPreview, JoshutoTheme, +}; use run::run; const PROGRAM_NAME: &str = "joshuto"; diff --git a/src/preview.rs b/src/preview.rs index 6002c99..3aaf9ce 100644 --- a/src/preview.rs +++ b/src/preview.rs @@ -61,39 +61,39 @@ fn preview_file(entry: &JoshutoDirEntry, win: &JoshutoPanel) { match path.extension() { Some(file_ext) => match PREVIEW_T.extension.get(file_ext.to_str().unwrap()) { Some(s) => preview_with(path, win, &s), - None => {}, -/* - None => if let Some(mimetype) = tree_magic::from_filepath(&path) { - match PREVIEW_T.mimetype.get(mimetype.as_str()) { - Some(s) => preview_with(path, win, &s), - None => if let Some(ind) = mimetype.find('/') { - let supertype = &mimetype[..ind]; - if supertype == "text" { - preview_text(path, win); - } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) { - preview_with(path, win, &s); + None => {} + /* + None => if let Some(mimetype) = tree_magic::from_filepath(&path) { + match PREVIEW_T.mimetype.get(mimetype.as_str()) { + Some(s) => preview_with(path, win, &s), + None => if let Some(ind) = mimetype.find('/') { + let supertype = &mimetype[..ind]; + if supertype == "text" { + preview_text(path, win); + } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) { + preview_with(path, win, &s); + } + }, + } } - }, - } - } -*/ + */ }, - None => {}, -/* - if let Some(mimetype) = tree_magic::from_filepath(&path) { - match PREVIEW_T.mimetype.get(mimetype.as_str()) { - Some(s) => preview_with(path, win, &s), - None => if let Some(ind) = mimetype.find('/') { - let supertype = &mimetype[..ind]; - if supertype == "text" { - preview_text(path, win); - } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) { - preview_with(path, win, &s); + None => {} + /* + if let Some(mimetype) = tree_magic::from_filepath(&path) { + match PREVIEW_T.mimetype.get(mimetype.as_str()) { + Some(s) => preview_with(path, win, &s), + None => if let Some(ind) = mimetype.find('/') { + let supertype = &mimetype[..ind]; + if supertype == "text" { + preview_text(path, win); + } else if let Some(s) = PREVIEW_T.mimetype.get(supertype) { + preview_with(path, win, &s); + } + }, } - }, - } - } -*/ + } + */ } } @@ -206,12 +206,12 @@ pub fn wprint_file_info(win: ncurses::WINDOW, file: &structs::JoshutoDirEntry) { ncurses::waddstr(win, &file_size_string); } -/* - ncurses::waddstr(win, " "); - if let Some(s) = tree_magic::from_filepath(&file.path) { - ncurses::waddstr(win, &s); - } -*/ + /* + ncurses::waddstr(win, " "); + if let Some(s) = tree_magic::from_filepath(&file.path) { + ncurses::waddstr(win, &s); + } + */ } pub fn redraw_tab_view(win: &window::JoshutoPanel, context: &JoshutoContext) { |