mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
style: remove unnecessary lazy evaluations
This commit is contained in:
parent
d6351a7cf3
commit
2986a9eee0
2 changed files with 5 additions and 2 deletions
|
@ -78,7 +78,7 @@ fn split_paragraphs(lines: &[&str]) -> Vec<String> {
|
||||||
let len = slice
|
let len = slice
|
||||||
.iter()
|
.iter()
|
||||||
.position(|s| is_blank(s))
|
.position(|s| is_blank(s))
|
||||||
.unwrap_or_else(|| slice.len());
|
.unwrap_or(slice.len());
|
||||||
|
|
||||||
last_line += start + len;
|
last_line += start + len;
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,13 @@ fn main() {
|
||||||
|
|
||||||
// Check for usage of -c
|
// Check for usage of -c
|
||||||
if let Some(config) = cli.config.as_deref() {
|
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
|
let input = cli
|
||||||
.input_file
|
.input_file
|
||||||
.as_deref()
|
.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(|| {
|
.unwrap_or_else(|| {
|
||||||
let mut app = Cli::into_app();
|
let mut app = Cli::into_app();
|
||||||
app.error(
|
app.error(
|
||||||
|
|
Loading…
Reference in a new issue