From 537f6566262c6f964bcd2f7c94b7f7b235106352 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 5 Dec 2023 00:49:33 +0100 Subject: [PATCH] Use Display instead of Debug to log errors. (#4830) --- wgpu-core/src/device/global.rs | 28 +++++++++++++--------------- wgpu-core/src/device/life.rs | 2 +- wgpu-core/src/device/resource.rs | 4 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index b043e2106..0f3cee912 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -526,7 +526,7 @@ impl Global { if wait { match device.wait_for_submit(last_submit_index) { Ok(()) => (), - Err(e) => log::error!("Failed to wait for buffer {:?}: {:?}", buffer_id, e), + Err(e) => log::error!("Failed to wait for buffer {:?}: {}", buffer_id, e), } } } @@ -574,7 +574,7 @@ impl Global { return (id, None); }; - log::error!("Device::create_texture error {error:?}"); + log::error!("Device::create_texture error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) @@ -648,7 +648,7 @@ impl Global { return (id, None); }; - log::error!("Device::create_texture error {error:?}"); + log::error!("Device::create_texture error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) @@ -702,7 +702,7 @@ impl Global { return (id, None); }; - log::error!("Device::create_buffer error {error:?}"); + log::error!("Device::create_buffer error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) @@ -790,7 +790,7 @@ impl Global { if wait { match device.wait_for_submit(last_submit_index) { Ok(()) => (), - Err(e) => log::error!("Failed to wait for texture {:?}: {:?}", texture_id, e), + Err(e) => log::error!("Failed to wait for texture {texture_id:?}: {e}"), } } } @@ -835,7 +835,7 @@ impl Global { return (id, None); }; - log::error!("Texture::create_view({texture_id:?}) error {error:?}"); + log::error!("Texture::create_view({texture_id:?}) error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) } @@ -865,11 +865,9 @@ impl Global { if wait { match view.device.wait_for_submit(last_submit_index) { Ok(()) => (), - Err(e) => log::error!( - "Failed to wait for texture view {:?}: {:?}", - texture_view_id, - e - ), + Err(e) => { + log::error!("Failed to wait for texture view {texture_view_id:?}: {e}") + } } } } @@ -1217,7 +1215,7 @@ impl Global { return (id, None); }; - log::error!("Device::create_shader_module error: {error:?}"); + log::error!("Device::create_shader_module error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) @@ -1274,7 +1272,7 @@ impl Global { return (id, None); }; - log::error!("Device::create_shader_module_spirv error: {error:?}"); + log::error!("Device::create_shader_module_spirv error: {error}"); let id = fid.assign_error(desc.label.borrow_or_default()); (id, Some(error)) @@ -1598,7 +1596,7 @@ impl Global { } } - log::error!("Device::create_render_pipeline error {error:?}"); + log::error!("Device::create_render_pipeline error: {error}"); (id, Some(error)) } @@ -2321,7 +2319,7 @@ impl Global { if let Some(callback) = operation.callback.take() { callback.call(Err(err.clone())); } - log::error!("Buffer::map_async error {err:?}"); + log::error!("Buffer::map_async error: {err}"); return Err(err); } diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index 8b421c11a..0193d0987 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -930,7 +930,7 @@ impl LifetimeTracker { Ok(()) } Err(e) => { - log::error!("Mapping failed {:?}", e); + log::error!("Mapping failed: {e}"); Err(e) } } diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index b6ee9aec0..015996c98 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -268,7 +268,7 @@ impl Device { Some(trace) } Err(e) => { - log::error!("Unable to start a trace in '{:?}': {:?}", path, e); + log::error!("Unable to start a trace in '{path:?}': {e}"); None } })), @@ -3358,7 +3358,7 @@ impl Device { .unwrap() .wait(fence, current_index, CLEANUP_WAIT_MS) } { - log::error!("failed to wait for the device: {:?}", error); + log::error!("failed to wait for the device: {error}"); } let mut life_tracker = self.lock_life(); let _ = life_tracker.triage_submissions(