From c42cc3bdcb1b3874101491e0745a99416b53133a Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sat, 27 Mar 2021 19:12:34 -0400 Subject: [PATCH] fix new clippy warnings --- cli/src/argparse/mod.rs | 5 +++++ cli/src/invocation/mod.rs | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cli/src/argparse/mod.rs b/cli/src/argparse/mod.rs index ab54326f1..3bdac1a8f 100644 --- a/cli/src/argparse/mod.rs +++ b/cli/src/argparse/mod.rs @@ -1,3 +1,8 @@ +// Nested functions that always return Ok(..) are used as callbacks in a context where a Result is +// expected, so the unnecessary_wraps clippy lint is not useful here. + +#![allow(clippy::unnecessary_wraps)] + /*! This module is responsible for parsing command lines (`Arglist`, an alias for `&[&str]`) into `Command` instances. diff --git a/cli/src/invocation/mod.rs b/cli/src/invocation/mod.rs index fd910a8f0..5bce1a16d 100644 --- a/cli/src/invocation/mod.rs +++ b/cli/src/invocation/mod.rs @@ -23,7 +23,7 @@ pub(crate) fn invoke(command: Command, settings: Config) -> anyhow::Result<()> { log::debug!("command: {:?}", command); log::debug!("settings: {:?}", settings); - let mut w = get_writer()?; + let mut w = get_writer(); // This function examines the command and breaks out the necessary bits to call one of the // `execute` functions in a submodule of `cmd`. @@ -136,10 +136,10 @@ fn get_server(settings: &Config) -> anyhow::Result> { } /// Get a WriteColor implementation based on whether the output is a tty. -fn get_writer() -> anyhow::Result { - Ok(StandardStream::stdout(if atty::is(atty::Stream::Stdout) { +fn get_writer() -> StandardStream { + StandardStream::stdout(if atty::is(atty::Stream::Stdout) { ColorChoice::Auto } else { ColorChoice::Never - })) + }) }