From 49f1dc080b3f8d5c31b9ee400164323152f42004 Mon Sep 17 00:00:00 2001 From: amtoine Date: Fri, 24 Feb 2023 10:58:56 +0100 Subject: [PATCH] make clippy happy by using `writeln!` and `.expect()` --- crates/nu-engine/src/documentation.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index 81acb70ef..0af1c17ee 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -213,7 +213,9 @@ fn get_documentation( match &example.result { Some(result) => { - let decl_id = engine_state.find_decl("table".as_bytes(), &[]).unwrap(); + let decl_id = engine_state + .find_decl("table".as_bytes(), &[]) + .expect("could not find `table` in the engine state"); let table = engine_state .get_decl(decl_id) .run( @@ -222,18 +224,18 @@ fn get_documentation( &Call::new(Span::new(0, 0)), PipelineData::Value(result.clone(), None), ) - .unwrap(); + .expect("could not run `table` on the output `Value` of the example"); for item in table { - let _ = write!( + let _ = writeln!( long_desc, - "{}\n", + "{}", item.into_string("", engine_state.get_config()) ); } } None => { - let _ = write!(long_desc, " {WD}...{RESET}\n"); + let _ = writeln!(long_desc, " {WD}...{RESET}"); } } }