Skip to content

Commit

Permalink
Fix and enable clippy::format_collect
Browse files Browse the repository at this point in the history
Summary: Just two simple fixes.

Reviewed By: JakobDegen

Differential Revision: D52508143

fbshipit-source-id: ddec9e6bbc659549b1b54a2e763bbc9c5263c979
  • Loading branch information
cjhopman authored and facebook-github-bot committed Jan 3, 2024
1 parent b53ade7 commit 518da2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions allocative/allocative/src/golden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![cfg(test)]

use std::env;
use std::fmt::Write;
use std::fs;

use crate::Allocative;
Expand Down Expand Up @@ -50,8 +51,10 @@ fn make_golden<T: Allocative>(value: &T) -> (String, String) {
"{header}{flamegraph}",
header = golden_header()
.lines()
.map(|line| format!("# {}\n", line))
.collect::<String>()
.fold(String::new(), |mut output, line| {
let _ = writeln!(output, "# {}", line);
output
})
);

let flamegraph_svg = flamegraph_svg.replace(
Expand Down
9 changes: 5 additions & 4 deletions starlark/src/docs/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

use std::fmt::Write;
use std::slice;

use dupe::Dupe;
Expand Down Expand Up @@ -143,11 +144,11 @@ fn render_function_parameters(params: &[DocParam]) -> Option<String> {
DocParam::Args { name, docs, .. } => Some((name, docs)),
DocParam::Kwargs { name, docs, .. } => Some((name, docs)),
})
.map(|(name, docs)| {
.fold(String::new(), |mut output, (name, docs)| {
let docs = render_doc_string(DSOpts::Combined, docs).unwrap_or_default();
format!("* `{name}`: {docs}\n")
})
.collect();
let _ = writeln!(output, "* `{name}`: {docs}");
output
});
Some(param_list)
}

Expand Down

0 comments on commit 518da2d

Please sign in to comment.