Skip to content

Conversation

@ehuss
Copy link
Contributor

@ehuss ehuss commented Sep 21, 2025

This does a little cleanup around the usage of filesystem functions:

  • Add mdbook_core::utils::fs::read_to_string as a wrapper around std::fs::read_to_string to provide better error messages. Use this wherever a file is read.
  • Add mdbook_core::utils::fs::create_dir_all as a wrapper around std::fs::create_dir_all to provide better error messages. Use this wherever a file is read.
  • Replace mdbook_core::utils::fs::write_file with write to mirror the std::fs::write API.
  • Remove mdbook_core::utils::fs::create_file. It was generally not used anymore.
  • Scrub the usage of std::fs to use the new wrappers. This doesn't remove it 100%, but it is now significantly reduced.

@ehuss ehuss added the Breaking Change This would require a SemVer breaking change label Sep 21, 2025
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Sep 21, 2025
@ehuss ehuss enabled auto-merge September 21, 2025 00:06
This does a little cleanup around the usage of filesystem functions:

- Add `mdbook_core::utils::fs::read_to_string` as a wrapper around
  `std::fs::read_to_string` to provide better error messages. Use
  this wherever a file is read.
- Add `mdbook_core::utils::fs::create_dir_all` as a wrapper around
  `std::fs::create_dir_all` to provide better error messages. Use
  this wherever a file is read.
- Replace `mdbook_core::utils::fs::write_file` with `write` to mirror
  the `std::fs::write` API.
- Remove `mdbook_core::utils::fs::create_file`. It was generally not
  used anymore.
- Scrub the usage of `std::fs` to use the new wrappers. This doesn't
  remove it 100%, but it is now significantly reduced.
@ehuss ehuss added this pull request to the merge queue Sep 21, 2025
Merged via the queue into rust-lang:master with commit 2aa2b95 Sep 21, 2025
14 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change This would require a SemVer breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants