Skip to content

Commit aaef121

Browse files
authored
chore: use serde_json::from_str (#203)
1 parent f50d9a4 commit aaef121

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

crates/core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ workspace = true
1818
alloy-primitives.workspace = true
1919
cfg-if.workspace = true
2020
dunce.workspace = true
21-
memmap2.workspace = true
2221
once_cell.workspace = true
2322
path-slash.workspace = true
2423
regex.workspace = true

crates/core/src/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,8 @@ pub fn tempdir(name: &str) -> Result<tempfile::TempDir, SolcIoError> {
587587
/// Reads the json file and deserialize it into the provided type.
588588
pub fn read_json_file<T: DeserializeOwned>(path: &Path) -> Result<T, SolcError> {
589589
// See: https://github.com/serde-rs/json/issues/160
590-
let file = fs::File::open(path).map_err(|err| SolcError::io(err, path))?;
591-
let bytes = unsafe { memmap2::Mmap::map(&file).map_err(|err| SolcError::io(err, path))? };
592-
serde_json::from_slice(&bytes).map_err(Into::into)
590+
let s = fs::read_to_string(path).map_err(|err| SolcError::io(err, path))?;
591+
serde_json::from_str(&s).map_err(Into::into)
593592
}
594593

595594
/// Writes serializes the provided value to JSON and writes it to a file.

0 commit comments

Comments
 (0)