summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2019-08-27 10:41:59 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-08-28 18:18:40 +0200
commit3a32be23c556c3863a48ba5547da797023a0c405 (patch)
tree3e66e665e0f391dba153f9af155693f648923e9f
parent8db954c79ad5d87a24a2b1f3644ff09ca7615ddb (diff)
downloadimag-3a32be23c556c3863a48ba5547da797023a0c405.tar.gz
imag-3a32be23c556c3863a48ba5547da797023a0c405.tar.xz
-rw-r--r--bin/core/imag-view/src/main.rs20
-rw-r--r--bin/core/imag-view/src/ui.rs1
2 files changed, 9 insertions, 12 deletions
diff --git a/bin/core/imag-view/src/main.rs b/bin/core/imag-view/src/main.rs
index 32377c35..cb35f0d0 100644
--- a/bin/core/imag-view/src/main.rs
+++ b/bin/core/imag-view/src/main.rs
@@ -112,12 +112,12 @@ fn main() {
let viewer = rt
.cli()
.value_of("in")
- .ok_or_else(|| Error::from(err_msg("No viewer given")))
+ .ok_or_else(|| err_msg("No viewer given"))
.map_err_trace_exit_unwrap();
let config = rt
.config()
- .ok_or_else(|| Error::from(err_msg("No configuration, cannot continue")))
+ .ok_or_else(|| err_msg("No configuration, cannot continue"))
.map_err_trace_exit_unwrap();
let query = format!("view.viewers.{}", viewer);
@@ -134,7 +134,7 @@ fn main() {
let mut handlebars = Handlebars::new();
handlebars.register_escape_fn(::handlebars::no_escape);
- let _ = handlebars
+ handlebars
.register_template_string("template", viewer_template)
.map_err(Error::from)
.map_err_trace_exit_unwrap();
@@ -156,7 +156,7 @@ fn main() {
let mut elems = call.split_whitespace();
let command_string = elems
.next()
- .ok_or_else(|| Error::from(err_msg("No command")))
+ .ok_or_else(|| err_msg("No command"))
.map_err_trace_exit_unwrap();
let mut cmd = Command::new(command_string);
@@ -204,9 +204,8 @@ fn main() {
.enumerate()
.for_each(|(n, entry)| {
if n != 0 {
- seperator
- .as_ref()
- .map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
+ if let Some(s) = seperator
+ .as_ref() { writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit() }
}
if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
@@ -238,9 +237,8 @@ fn main() {
.enumerate()
.for_each(|(n, entry)| {
if n != 0 {
- seperator
- .as_ref()
- .map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
+ if let Some(s) = seperator
+ .as_ref() { writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit() }
}
if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
@@ -279,7 +277,7 @@ fn create_tempfile_for<'a>(entry: &FileLockEntry<'a>, view_header: bool, hide_co
.path()
.to_str()
.map(String::from)
- .ok_or_else(|| Error::from(err_msg("Cannot build path")))
+ .ok_or_else(|| err_msg("Cannot build path"))
.map_err_trace_exit_unwrap();
(tmpfile, file_path)
diff --git a/bin/core/imag-view/src/ui.rs b/bin/core/imag-view/src/ui.rs
index c79fc96d..39a6ac64 100644
--- a/bin/core/imag-view/src/ui.rs
+++ b/bin/core/imag-view/src/ui.rs
@@ -93,7 +93,6 @@ impl IdPathProvider for PathProvider {
fn get_ids(matches: &ArgMatches) -> Result<Option<Vec<StoreId>>> {
matches.values_of("id")
.map(|v| v
- .into_iter()
.map(PathBuf::from)
.map(|pb| pb.into_storeid())
.collect::<Result<Vec<_>>>()