From fbf692d1063cb869e595d83c99b477b6bd37a051 Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Mon, 1 Jul 2024 05:36:03 -0700 Subject: [PATCH] Avoid an unnecessary collect into a Vec Summary: Simplify and avoid additional memory. Reviewed By: perehonchuk Differential Revision: D59218144 fbshipit-source-id: 643cf4ecc5217775401ec20aac8ea416b4625502 --- starlark-rust/starlark/src/docs/markdown.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/starlark-rust/starlark/src/docs/markdown.rs b/starlark-rust/starlark/src/docs/markdown.rs index afa4b0d27ea68..a677bd7040e93 100644 --- a/starlark-rust/starlark/src/docs/markdown.rs +++ b/starlark-rust/starlark/src/docs/markdown.rs @@ -137,10 +137,8 @@ fn render_function_parameters(params: &[DocParam]) -> Option { let mut lines_iter = docs.lines(); if let Some(first_line) = lines_iter.next() { - let rest_of_lines: Vec<&str> = lines_iter.collect(); - let _ = writeln!(output, "* `{name}`: {first_line}"); - for line in &rest_of_lines { + for line in lines_iter { let _ = writeln!(output, " {line}"); } } else {