From d059d0515226fe9fa5c7188ea50594112bba231a Mon Sep 17 00:00:00 2001 From: Casper Meijn Date: Wed, 11 Sep 2024 07:58:10 +0200 Subject: [PATCH] style: use `Path::display()` when printing a path (#1150) --- prost-build/src/config.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/prost-build/src/config.rs b/prost-build/src/config.rs index 5087cd418..7b74b931d 100644 --- a/prost-build/src/config.rs +++ b/prost-build/src/config.rs @@ -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( @@ -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, }; @@ -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 ), ) })?; @@ -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) } } @@ -1236,14 +1237,14 @@ pub fn protoc_include_from_env() -> Option { 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() ); }