style: remove unnecessary lazy evaluations

This commit is contained in:
Daniel Eades 2022-01-04 07:24:36 +00:00 committed by Ed Page
parent d6351a7cf3
commit 2986a9eee0
2 changed files with 5 additions and 2 deletions

View file

@ -78,7 +78,7 @@ fn split_paragraphs(lines: &[&str]) -> Vec<String> {
let len = slice
.iter()
.position(|s| is_blank(s))
.unwrap_or_else(|| slice.len());
.unwrap_or(slice.len());
last_line += start + len;

View file

@ -72,10 +72,13 @@ fn main() {
// Check for usage of -c
if let Some(config) = cli.config.as_deref() {
// todo: remove `#[allow(clippy::or_fun_call)]` lint when MSRV is bumped.
#[allow(clippy::or_fun_call)]
let input = cli
.input_file
.as_deref()
.or_else(|| cli.spec_in.as_deref())
// 'or' is preferred to 'or_else' here since `Option::as_deref` is 'const'
.or(cli.spec_in.as_deref())
.unwrap_or_else(|| {
let mut app = Cli::into_app();
app.error(