[Auto] bin/core/view: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:41:59 +02:00 committed by Matthias Beyer
parent 8db954c79a
commit 3a32be23c5
2 changed files with 9 additions and 12 deletions

View file

@ -112,12 +112,12 @@ fn main() {
let viewer = rt let viewer = rt
.cli() .cli()
.value_of("in") .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(); .map_err_trace_exit_unwrap();
let config = rt let config = rt
.config() .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(); .map_err_trace_exit_unwrap();
let query = format!("view.viewers.{}", viewer); let query = format!("view.viewers.{}", viewer);
@ -134,7 +134,7 @@ fn main() {
let mut handlebars = Handlebars::new(); let mut handlebars = Handlebars::new();
handlebars.register_escape_fn(::handlebars::no_escape); handlebars.register_escape_fn(::handlebars::no_escape);
let _ = handlebars handlebars
.register_template_string("template", viewer_template) .register_template_string("template", viewer_template)
.map_err(Error::from) .map_err(Error::from)
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
@ -156,7 +156,7 @@ fn main() {
let mut elems = call.split_whitespace(); let mut elems = call.split_whitespace();
let command_string = elems let command_string = elems
.next() .next()
.ok_or_else(|| Error::from(err_msg("No command"))) .ok_or_else(|| err_msg("No command"))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let mut cmd = Command::new(command_string); let mut cmd = Command::new(command_string);
@ -204,9 +204,8 @@ fn main() {
.enumerate() .enumerate()
.for_each(|(n, entry)| { .for_each(|(n, entry)| {
if n != 0 { if n != 0 {
seperator if let Some(s) = seperator
.as_ref() .as_ref() { writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit() }
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
} }
if let Err(e) = viewer.view_entry(&entry, &mut outlock) { if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
@ -238,9 +237,8 @@ fn main() {
.enumerate() .enumerate()
.for_each(|(n, entry)| { .for_each(|(n, entry)| {
if n != 0 { if n != 0 {
seperator if let Some(s) = seperator
.as_ref() .as_ref() { writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit() }
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
} }
if let Err(e) = viewer.view_entry(&entry, &mut outlock) { 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() .path()
.to_str() .to_str()
.map(String::from) .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(); .map_err_trace_exit_unwrap();
(tmpfile, file_path) (tmpfile, file_path)

View file

@ -93,7 +93,6 @@ impl IdPathProvider for PathProvider {
fn get_ids(matches: &ArgMatches) -> Result<Option<Vec<StoreId>>> { fn get_ids(matches: &ArgMatches) -> Result<Option<Vec<StoreId>>> {
matches.values_of("id") matches.values_of("id")
.map(|v| v .map(|v| v
.into_iter()
.map(PathBuf::from) .map(PathBuf::from)
.map(|pb| pb.into_storeid()) .map(|pb| pb.into_storeid())
.collect::<Result<Vec<_>>>() .collect::<Result<Vec<_>>>()