From c1b8fae3ccb26849b3be9b6029450909204544ac Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 17 Jul 2022 21:37:47 +0900 Subject: [PATCH] Fix clippy::or_fun_call warning in example ``` warning: use of `unwrap_or` followed by a function call --> examples/ls.rs:15:35 | 15 | let path = env::args().nth(1).unwrap_or(".".into()); | ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| ".".into())` | = note: `#[warn(clippy::or_fun_call)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call ``` --- examples/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ls.rs b/examples/ls.rs index 627318e..878045c 100644 --- a/examples/ls.rs +++ b/examples/ls.rs @@ -12,7 +12,7 @@ use blocking::Unblock; use futures_lite::{future, prelude::*}; fn main() -> io::Result<()> { - let path = env::args().nth(1).unwrap_or(".".into()); + let path = env::args().nth(1).unwrap_or_else(|| ".".into()); future::block_on(async { let mut dir = Unblock::new(fs::read_dir(path)?);