Skip to content

Commit

Permalink
style: use Path::display() when printing a path (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspermeijn authored Sep 11, 2024
1 parent 18c4681 commit d059d05
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions prost-build/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ impl Config {

if let Some(ref include_file) = self.include_file {
let path = target.join(include_file);
trace!("Writing include file: {:?}", path);
trace!("Writing include file: {}", path.display());
let mut buffer = Vec::new();
self.write_line(&mut buffer, 0, "// This file is @generated by prost-build.")?;
self.write_includes(
Expand Down Expand Up @@ -943,7 +943,7 @@ impl Config {
)),
Err(err) => return Err(Error::new(
err.kind(),
format!("failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): (path: {:?}): {}", &self.protoc_executable, err),
format!("failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): (path: {}): {}", &self.protoc_executable.display(), err),
)),
Ok(output) => output,
};
Expand All @@ -960,8 +960,9 @@ impl Config {
Error::new(
e.kind(),
format!(
"unable to open file_descriptor_set_path: {:?}, OS: {}",
&file_descriptor_set_path, e
"unable to open file_descriptor_set_path: {}, OS: {}",
file_descriptor_set_path.display(),
e
),
)
})?;
Expand Down Expand Up @@ -1140,10 +1141,10 @@ fn write_file_if_changed(path: &Path, content: &[u8]) -> std::io::Result<()> {
.map(|previous_content| previous_content == content)
.unwrap_or(false)
{
trace!("unchanged: {:?}", path);
trace!("unchanged: {}", path.display());
Ok(())
} else {
trace!("writing: {:?}", path);
trace!("writing: {}", path.display());
fs::write(path, content)
}
}
Expand Down Expand Up @@ -1236,14 +1237,14 @@ pub fn protoc_include_from_env() -> Option<PathBuf> {

if !protoc_include.exists() {
panic!(
"PROTOC_INCLUDE environment variable points to non-existent directory ({:?})",
protoc_include
"PROTOC_INCLUDE environment variable points to non-existent directory ({})",
protoc_include.display()
);
}
if !protoc_include.is_dir() {
panic!(
"PROTOC_INCLUDE environment variable points to a non-directory file ({:?})",
protoc_include
"PROTOC_INCLUDE environment variable points to a non-directory file ({})",
protoc_include.display()
);
}

Expand Down

0 comments on commit d059d05

Please sign in to comment.