-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
165 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[[disallowed-methods]] | ||
path = "std::process::Command::output" | ||
reason = "Use command_error::CommandExt::output_checked[_with][_utf8]" | ||
|
||
[[disallowed-methods]] | ||
path = "std::process::Command::status" | ||
reason = "Use command_error::CommandExt::status_checked[_with]" | ||
|
||
[[disallowed-methods]] | ||
path = "std::process::Command::spawn" | ||
reason = "Use command_error::CommandExt::spawn_checked" | ||
|
||
[[disallowed-methods]] | ||
path = "std::process::Child::try_wait" | ||
reason = "Use command_error::ChildExt::try_wait_checked[_with]" | ||
|
||
[[disallowed-methods]] | ||
path = "std::process::Child::wait" | ||
reason = "Use command_error::ChildExt::wait_checked[_with]" | ||
|
||
[[disallowed-methods]] | ||
path = "std::process::Child::wait_with_output" | ||
reason = "Use command_error::ChildExt::output_checked[_with][_utf8]" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::rename" | ||
reason = "Use git_prole::fs::rename" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::rename" | ||
reason = "Use git_prole::fs::rename" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::create_dir_all" | ||
reason = "Use git_prole::fs::create_dir_all" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::create_dir_all" | ||
reason = "Use git_prole::fs::create_dir_all" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::create_dir" | ||
reason = "Use git_prole::fs::create_dir" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::create_dir" | ||
reason = "Use git_prole::fs::create_dir" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::remove_dir" | ||
reason = "Use git_prole::fs::remove_dir" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::remove_dir" | ||
reason = "Use git_prole::fs::remove_dir" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::read_to_string" | ||
reason = "Use git_prole::fs::read_to_string" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::read_to_string" | ||
reason = "Use git_prole::fs::read_to_string" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::copy" | ||
reason = "Use git_prole::fs::copy" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::copy" | ||
reason = "Use git_prole::fs::copy" | ||
|
||
[[disallowed-methods]] | ||
path = "fs_err::write" | ||
reason = "Use git_prole::fs::copy" | ||
|
||
[[disallowed-methods]] | ||
path = "std::fs::write" | ||
reason = "Use git_prole::fs::copy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//! Like [`fs_err`], but the functions are instrumented with [`tracing::instrument`] and return | ||
//! [`miette::Result`] instead of [`std::io::Result`]. | ||
use std::fmt::Debug; | ||
use std::path::Path; | ||
|
||
use miette::IntoDiagnostic; | ||
use tracing::instrument; | ||
|
||
#[instrument(level = "trace")] | ||
pub fn rename<P, Q>(from: P, to: Q) -> miette::Result<()> | ||
where | ||
P: AsRef<Path> + Debug, | ||
Q: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::rename(from, to).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn create_dir<P>(path: P) -> miette::Result<()> | ||
where | ||
P: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::create_dir(path).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn create_dir_all<P>(path: P) -> miette::Result<()> | ||
where | ||
P: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::create_dir_all(path).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn remove_dir<P>(path: P) -> miette::Result<()> | ||
where | ||
P: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::remove_dir(path).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn read_to_string<P>(path: P) -> miette::Result<String> | ||
where | ||
P: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::read_to_string(path).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn copy<P, Q>(from: P, to: Q) -> miette::Result<u64> | ||
where | ||
P: AsRef<Path> + Debug, | ||
Q: AsRef<Path> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::copy(from, to).into_diagnostic() | ||
} | ||
|
||
#[instrument(level = "trace")] | ||
pub fn write<P, C>(path: P, contents: C) -> miette::Result<()> | ||
where | ||
P: AsRef<Path> + Debug, | ||
C: AsRef<[u8]> + Debug, | ||
{ | ||
#[expect(clippy::disallowed_methods)] | ||
fs_err::write(path, contents).into_diagnostic() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters