From 7a01799f490739612be27725f1584a995f6b1491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=82=B3=E6=9D=83?= <695601626@qq.com> Date: Fri, 6 Oct 2023 02:49:09 +0800 Subject: chore: update to Rust 1.73 (#20781) --- cli/util/fs.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cli/util') diff --git a/cli/util/fs.rs b/cli/util/fs.rs index 93403659a..9aeeb62cc 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -9,6 +9,7 @@ use deno_runtime::deno_crypto::rand; use deno_runtime::deno_node::PathClean; use std::borrow::Cow; use std::env::current_dir; +use std::fmt::Write as FmtWrite; use std::fs::OpenOptions; use std::io::Error; use std::io::ErrorKind; @@ -57,9 +58,10 @@ pub fn atomic_write_file>( fn inner(file_path: &Path, data: &[u8], mode: u32) -> std::io::Result<()> { let temp_file_path = { - let rand: String = (0..4) - .map(|_| format!("{:02x}", rand::random::())) - .collect(); + let rand: String = (0..4).fold(String::new(), |mut output, _| { + let _ = write!(output, "{:02x}", rand::random::()); + output + }); let extension = format!("{rand}.tmp"); file_path.with_extension(extension) }; -- cgit v1.2.3