fix new clippy warnings

This commit is contained in:
Dustin J. Mitchell 2021-03-27 19:12:34 -04:00
parent 7ed2bf4441
commit c42cc3bdcb
2 changed files with 9 additions and 4 deletions

View file

@ -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.

View file

@ -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<Box<dyn Server>> {
}
/// Get a WriteColor implementation based on whether the output is a tty.
fn get_writer() -> anyhow::Result<StandardStream> {
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
}))
})
}