Skip to content

Commit

Permalink
Avoid an unnecessary collect into a Vec
Browse files Browse the repository at this point in the history
Summary: Simplify and avoid additional memory.

Reviewed By: perehonchuk

Differential Revision: D59218144

fbshipit-source-id: 643cf4ecc5217775401ec20aac8ea416b4625502
  • Loading branch information
ndmitchell authored and facebook-github-bot committed Jul 1, 2024
1 parent b1a1190 commit fbf692d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions starlark-rust/starlark/src/docs/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ fn render_function_parameters(params: &[DocParam]) -> Option<String> {

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 {
Expand Down

0 comments on commit fbf692d

Please sign in to comment.