From de0109169d4b3eb6c0a8460b13df27c5718f262c Mon Sep 17 00:00:00 2001 From: konsti Date: Thu, 7 Mar 2024 13:27:37 +0100 Subject: [PATCH] Fix uv tokio extra, part 2 (#2274) Follow to #2272 by adding the tokio gate to `read_to_string`. --- crates/uv-fs/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/uv-fs/src/lib.rs b/crates/uv-fs/src/lib.rs index 81818e003..72e75c282 100644 --- a/crates/uv-fs/src/lib.rs +++ b/crates/uv-fs/src/lib.rs @@ -1,5 +1,4 @@ use std::fmt::Display; -use std::io::Read; use std::path::{Path, PathBuf}; use fs2::FileExt; @@ -16,7 +15,10 @@ mod path; /// Reads the contents of the file path into memory as a `String`. /// /// If the file path is `-`, then contents are read from stdin instead. +#[cfg(feature = "tokio")] pub async fn read_to_string(path: impl AsRef) -> std::io::Result { + use std::io::Read; + let path = path.as_ref(); if path == Path::new("-") { let mut buf = String::with_capacity(1024);