Fix uv tokio extra, part 2 (#2274)

Follow to #2272 by adding the tokio gate to `read_to_string`.
This commit is contained in:
konsti 2024-03-07 13:27:37 +01:00 committed by GitHub
parent 953a13f12e
commit de0109169d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<Path>) -> std::io::Result<String> {
use std::io::Read;
let path = path.as_ref();
if path == Path::new("-") {
let mut buf = String::with_capacity(1024);