Repository: gfx-rs/wgpu
Pull request #6316 (2024-09-23 17:25:32)

style: simplify string formatting for readability
**Description**
The goal of this pull request is to improve code readability and maintainability.

**Testing**
I ran `cargo xtask test` locally.

<!-- 
Thanks for filing! The codeowners file will automatically request reviews from the appropriate teams.

After you get a review and have addressed any comments, please explicitly re-request a review from the
person(s) who reviewed your changes. This will make sure it gets re-added to their review queue - you're no bothering us!
-->

**Checklist**

- [x] Run `cargo fmt`.
- [x] Run `cargo clippy`. If applicable, add:
  - [x] `--target wasm32-unknown-unknown`
  - [ ] `--target wasm32-unknown-emscripten`
- [x] Run `cargo xtask test` to run tests.
- [ ] Add change to `CHANGELOG.md`. See simple instructions inside file.


ErichDonGubler: I think we'd be open to follow-up work that set the lint to warn-by-default! 😀
hamirmahal: Sure, do you want that follow-up work in this PR, or a separate one?

Patch:
diff --git a/benches/benches/root.rs b/benches/benches/root.rs
index 064617783..630ea6027 100644
--- a/benches/benches/root.rs
+++ b/benches/benches/root.rs
@@ -39,7 +39,7 @@ impl DeviceState {
 
         let adapter_info = adapter.get_info();
 
-        eprintln!("{:?}", adapter_info);
+        eprintln!("{adapter_info:?}");
 
         let (device, queue) = block_on(adapter.request_device(
             &wgpu::DeviceDescriptor {
diff --git a/benches/benches/shader.rs b/benches/benches/shader.rs
index c6aa631d9..f1a949412 100644
--- a/benches/benches/shader.rs
+++ b/benches/benches/shader.rs
@@ -40,7 +40,7 @@ impl Inputs {
                     _ => continue,
                 },
                 Err(e) => {
-                    eprintln!("Skipping file: {:?}", e);
+                    eprintln!("Skipping file: {e:?}");
                     continue;
                 }
             }
diff --git a/deno_webgpu/queue.rs b/deno_webgpu/queue.rs
index fdbf993f8..5915b68f2 100644
--- a/deno_webgpu/queue.rs
+++ b/deno_webgpu/queue.rs
@@ -44,7 +44,7 @@ pub fn op_webgpu_queue_submit(
         })
         .collect::<Result<Vec<_>, AnyError>>()?;
 
-    let maybe_err = instance.queue_submit(queue, &ids).err();
+    let maybe_err = instance.queue_submit(queue, &ids).err().map(|(_idx, e)| e);
 
     for rid in command_buffers {
         let resource = state.resource_table.take::<WebGpuCommandBuffer>(rid)?;
diff --git a/examples/src/main.rs b/examples/src/main.rs
index 8b149d5a2..5d29d484b 100644
--- a/examples/src/main.rs
+++ b/examples/src/main.rs
@@ -201,7 +201,7 @@ fn print_unknown_example(_result: Option<String>) {}
 #[cfg(not(target_arch = "wasm32"))]
 fn print_unknown_example(result: Option<String>) {
     if let Some(example) = result {
-        println!("Unknown example: {}", example);
+        println!("Unknown example: {example}");
     } else {
         println!("Please specify an example as the first argument!");
     }
diff --git a/examples/src/timestamp_queries/mod.rs b/examples/src/timestamp_queries/mod.rs
index 2921ae4c8..a253938a3 100644
--- a/examples/src/timestamp_queries/mod.rs
+++ b/examples/src/timestamp_queries/mod.rs
@@ -227,7 +227,7 @@ async fn run() {
 
     let queries = submit_render_and_compute_pass_with_queries(&device, &queue);
     let raw_results = queries.wait_for_results(&device);
-    println!("Raw timestamp buffer contents: {:?}", raw_results);
+    println!("Raw timestamp buffer contents: {raw_results:?}");
     QueryResults::from_raw_results(raw_results, timestamps_inside_passes).print(&queue);
 }
 
diff --git a/naga-cli/src/bin/naga.rs b/naga-cli/src/bin/naga.rs
index e28519cb0..8cec1801c 100644
--- a/naga-cli/src/bin/naga.rs
+++ b/naga-cli/src/bin/naga.rs
@@ -853,7 +853,7 @@ fn bulk_validate(args: Args, params: &Parameters) -> anyhow::Result<()> {
             Ok(parsed) => parsed,
             Err(error) => {
                 invalid.push(input_path.clone());
-                eprintln!("Error validating {}:", input_path);
+                eprintln!("Error validating {input_path}:");
                 eprintln!("{error}");
                 continue;
             }
@@ -866,7 +866,7 @@ fn bulk_validate(args: Args, params: &Parameters) -> anyhow::Result<()> {
 
         if let Err(error) = validator.validate(&module) {
             invalid.push(input_path.clone());
-            eprintln!("Error validating {}:", input_path);
+            eprintln!("Error validating {input_path}:");
             if let Some(input) = &input_text {
                 let filename = path.file_name().and_then(std::ffi::OsStr::to_str);
                 emit_annotated_error(&error, filename.unwrap_or("input"), input);
diff --git a/naga/src/back/dot/mod.rs b/naga/src/back/dot/mod.rs
index 4f29ab776..278087965 100644
--- a/naga/src/back/dot/mod.rs
+++ b/naga/src/back/dot/mod.rs
@@ -698,7 +698,7 @@ fn write_function_expressions(
             E::RayQueryGetIntersection { query, committed } => {
                 edges.insert("", query);
                 let ty = if committed { "Committed" } else { "Candidate" };
-                (format!("rayQueryGet{}Intersection", ty).into(), 4)
+                (format!("rayQueryGet{ty}Intersection").into(), 4)
             }
             E::SubgroupBallotResult => ("SubgroupBallotResult".into(), 4),
             E::SubgroupOperationResult { .. } => ("SubgroupOperationResult".into(), 4),
diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs
index 159d9cdcf..2ce9f22f2 100644
--- a/naga/src/back/glsl/mod.rs
+++ b/naga/src/back/glsl/mod.rs
@@ -2645,15 +2645,15 @@ impl<'a, W: Write> Writer<'a, W> {
                 match literal {
                     // Floats are written using `Debug` instead of `Display` because it always appends the
                     // decimal part even it's zero which is needed for a valid glsl float constant
-                    crate::Literal::F64(value) => write!(self.out, "{:?}LF", value)?,
-                    crate::Literal::F32(value) => write!(self.out, "{:?}", value)?,
+                    crate::Literal::F64(value) => write!(self.out, "{value:?}LF")?,
+                    crate::Literal::F32(value) => write!(self.out, "{value:?}")?,
                     // Unsigned integers need a `u` at the end
                     //
                     // While `core` doesn't necessarily need it, it's allowed and since `es` needs it we
                     // always write it as the extra branch wouldn't have any benefit in readability
-                    crate::Literal::U32(value) => write!(self.out, "{}u", value)?,
-                    crate::Literal::I32(value) => write!(self.out, "{}", value)?,
-                    crate::Literal::Bool(value) => write!(self.out, "{}", value)?,
+                    crate::Literal::U32(value) => write!(self.out, "{value}u")?,
+                    crate::Literal::I32(value) => write!(self.out, "{value}")?,
+                    crate::Literal::Bool(value) => write!(self.out, "{value}")?,
                     crate::Literal::I64(_) => {
                         return Err(Error::Custom("GLSL has no 64-bit integer type".into()));
                     }
@@ -4614,7 +4614,7 @@ impl<'a, W: Write> Writer<'a, W> {
 
                 for i in 0..count.get() {
                     // Add the array accessor and recurse.
-                    segments.push(format!("[{}]", i));
+                    segments.push(format!("[{i}]"));
                     self.collect_push_constant_items(base, segments, layouter, offset, items);
                     segments.pop();
                 }
diff --git a/naga/src/back/hlsl/help.rs b/naga/src/back/hlsl/help.rs
index 80f385d01..9032d22c8 100644
--- a/naga/src/back/hlsl/help.rs
+++ b/naga/src/back/hlsl/help.rs
@@ -1046,8 +1046,7 @@ impl<'a, W: Write> super::Writer<'a, W> {
                         }
                         ref other => {
                             return Err(super::Error::Unimplemented(format!(
-                                "Array length of base {:?}",
-                                other
+                                "Array length of base {other:?}"
                             )))
                         }
                     };
diff --git a/naga/src/back/hlsl/storage.rs b/naga/src/back/hlsl/storage.rs
index 4d3a6af56..9fbdf6769 100644
--- a/naga/src/back/hlsl/storage.rs
+++ b/naga/src/back/hlsl/storage.rs
@@ -350,7 +350,7 @@ impl<W: fmt::Write> super::Writer<'_, W> {
                     self.write_store_value(module, &value, func_ctx)?;
                     writeln!(self.out, "));")?;
                 } else {
-                    write!(self.out, "{}{}.Store(", level, var_name)?;
+                    write!(self.out, "{level}{var_name}.Store(")?;
                     self.write_storage_address(module, &chain, func_ctx)?;
                     write!(self.out, ", ")?;
                     self.write_store_value(module, &value, func_ctx)?;
diff --git a/naga/src/back/hlsl/writer.rs b/naga/src/back/hlsl/writer.rs
index e33fc79f2..0eb18f0e1 100644
--- a/naga/src/back/hlsl/writer.rs
+++ b/naga/src/back/hlsl/writer.rs
@@ -965,7 +965,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
         let constant = &module.constants[handle];
         self.write_type(module, constant.ty)?;
         let name = &self.names[&NameKey::Constant(handle)];
-        write!(self.out, " {}", name)?;
+        write!(self.out, " {name}")?;
         // Write size for array type
         if let TypeInner::Array { base, size, .. } = module.types[constant.ty].inner {
             self.write_array_size(module, base, size)?;
@@ -2383,11 +2383,11 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
                 // decimal part even it's zero
                 crate::Literal::F64(value) => write!(self.out, "{value:?}L")?,
                 crate::Literal::F32(value) => write!(self.out, "{value:?}")?,
-                crate::Literal::U32(value) => write!(self.out, "{}u", value)?,
-                crate::Literal::I32(value) => write!(self.out, "{}", value)?,
-                crate::Literal::U64(value) => write!(self.out, "{}uL", value)?,
-                crate::Literal::I64(value) => write!(self.out, "{}L", value)?,
-                crate::Literal::Bool(value) => write!(self.out, "{}", value)?,
+                crate::Literal::U32(value) => write!(self.out, "{value}u")?,
+                crate::Literal::I32(value) => write!(self.out, "{value}")?,
+                crate::Literal::U64(value) => write!(self.out, "{value}uL")?,
+                crate::Literal::I64(value) => write!(self.out, "{value}L")?,
+                crate::Literal::Bool(value) => write!(self.out, "{value}")?,
                 crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => {
                     return Err(Error::Custom(
                         "Abstract types should not appear in IR presented to backends".into(),
diff --git a/naga/src/back/msl/mod.rs b/naga/src/back/msl/mod.rs
index 96dd142a5..4bc06469e 100644
--- a/naga/src/back/msl/mod.rs
+++ b/naga/src/back/msl/mod.rs
@@ -437,8 +437,7 @@ impl Options {
                     })
                 }
                 LocationMode::Uniform => Err(Error::GenericValidation(format!(
-                    "Unexpected Binding::Location({}) for the Uniform mode",
-                    location
+                    "Unexpected Binding::Location({location}) for the Uniform mode"
                 ))),
             },
         }
diff --git a/naga/src/back/msl/writer.rs b/naga/src/back/msl/writer.rs
index e09ca557a..7ab97f491 100644
--- a/naga/src/back/msl/writer.rs
+++ b/naga/src/back/msl/writer.rs
@@ -3820,12 +3820,11 @@ impl<W: Write> Writer<W> {
                     writeln!(self.out)?;
                     writeln!(
                         self.out,
-                        "{} {defined_func_name}({arg_type_name} arg) {{
+                        "{struct_name} {defined_func_name}({arg_type_name} arg) {{
     {other_type_name} other;
     {arg_type_name} fract = {NAMESPACE}::{called_func_name}(arg, other);
-    return {}{{ fract, other }};
-}}",
-                        struct_name, struct_name
+    return {struct_name}{{ fract, other }};
+}}"
                     )?;
                 }
                 &crate::PredeclaredType::AtomicCompareExchangeWeakResult { .. } => {}
diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs
index 0f2635eb0..e8b942a62 100644
--- a/naga/src/back/wgsl/writer.rs
+++ b/naga/src/back/wgsl/writer.rs
@@ -1221,31 +1221,31 @@ impl<W: Write> Writer<W> {
 
         match expressions[expr] {
             Expression::Literal(literal) => match literal {
-                crate::Literal::F32(value) => write!(self.out, "{}f", value)?,
-                crate::Literal::U32(value) => write!(self.out, "{}u", value)?,
+                crate::Literal::F32(value) => write!(self.out, "{value}f")?,
+                crate::Literal::U32(value) => write!(self.out, "{value}u")?,
                 crate::Literal::I32(value) => {
                     // `-2147483648i` is not valid WGSL. The most negative `i32`
                     // value can only be expressed in WGSL using AbstractInt and
                     // a unary negation operator.
                     if value == i32::MIN {
-                        write!(self.out, "i32({})", value)?;
+                        write!(self.out, "i32({value})")?;
                     } else {
-                        write!(self.out, "{}i", value)?;
+                        write!(self.out, "{value}i")?;
                     }
                 }
-                crate::Literal::Bool(value) => write!(self.out, "{}", value)?,
-                crate::Literal::F64(value) => write!(self.out, "{:?}lf", value)?,
+                crate::Literal::Bool(value) => write!(self.out, "{value}")?,
+                crate::Literal::F64(value) => write!(self.out, "{value:?}lf")?,
                 crate::Literal::I64(value) => {
                     // `-9223372036854775808li` is not valid WGSL. The most negative `i64`
                     // value can only be expressed in WGSL using AbstractInt and
                     // a unary negation operator.
                     if value == i64::MIN {
-                        write!(self.out, "i64({})", value)?;
+                        write!(self.out, "i64({value})")?;
                     } else {
-                        write!(self.out, "{}li", value)?;
+                        write!(self.out, "{value}li")?;
                     }
                 }
-                crate::Literal::U64(value) => write!(self.out, "{:?}lu", value)?,
+                crate::Literal::U64(value) => write!(self.out, "{value:?}lu")?,
                 crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => {
                     return Err(Error::Custom(
                         "Abstract types should not appear in IR presented to backends".into(),
diff --git a/naga/src/front/wgsl/error.rs b/naga/src/front/wgsl/error.rs
index 3d4ac6218..a7986ec89 100644
--- a/naga/src/front/wgsl/error.rs
+++ b/naga/src/front/wgsl/error.rs
@@ -790,11 +790,11 @@ impl<'a> Error<'a> {
             Error::ConcretizationFailed(ref error) => {
                 let ConcretizationFailedError { expr_span, ref expr_type, ref scalar, ref inner } = **error;
                 ParseError {
-                    message: format!("failed to convert expression to a concrete type: {}", inner),
+                    message: format!("failed to convert expression to a concrete type: {inner}"),
                     labels: vec![
                         (
                             expr_span,
-                            format!("this expression has type {}", expr_type).into(),
+                            format!("this expression has type {expr_type}").into(),
                         )
                     ],
                     notes: vec![
diff --git a/player/src/bin/play.rs b/player/src/bin/play.rs
index 558eb194b..842a05148 100644
--- a/player/src/bin/play.rs
+++ b/player/src/bin/play.rs
@@ -91,7 +91,7 @@ fn main() {
                 Some(queue_id),
             );
             if let Err(e) = res {
-                panic!("{:?}", e);
+                panic!("{e:?}");
             }
             (device_id, queue_id)
         }
diff --git a/player/src/lib.rs b/player/src/lib.rs
index 241c19096..3b0b4149a 100644
--- a/player/src/lib.rs
+++ b/player/src/lib.rs
@@ -237,7 +237,7 @@ impl GlobalPlay for wgc::global::Global {
                     let module = ron::de::from_str(&code).unwrap();
                     wgc::pipeline::ShaderModuleSource::Naga(module)
                 } else {
-                    panic!("Unknown shader {}", data);
+                    panic!("Unknown shader {data}");
                 };
                 let (_, error) = self.device_create_shader_module(device, &desc, source, Some(id));
                 if let Some(e) = error {
diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs
index f576b2412..bd6d99f1c 100644
--- a/wgpu-core/src/device/queue.rs
+++ b/wgpu-core/src/device/queue.rs
@@ -1027,11 +1027,13 @@ impl Global {
         &self,
         queue_id: QueueId,
         command_buffer_ids: &[id::CommandBufferId],
-    ) -> Result<SubmissionIndex, QueueSubmitError> {
+    ) -> Result<SubmissionIndex, (SubmissionIndex, QueueSubmitError)> {
         profiling::scope!("Queue::submit");
         api_log!("Queue::submit {queue_id:?}");
 
-        let (submit_index, callbacks) = {
+        let submit_index;
+
+        let res = 'error: {
             let hub = &self.hub;
 
             let queue = hub.queues.get(queue_id);
@@ -1042,7 +1044,7 @@ impl Global {
 
             // Fence lock must be acquired after the snatch lock everywhere to avoid deadlocks.
             let mut fence = device.fence.write();
-            let submit_index = device
+            submit_index = device
                 .active_submission_index
                 .fetch_add(1, Ordering::SeqCst)
                 + 1;
@@ -1119,18 +1121,29 @@ impl Global {
                         }
 
                         // execute resource transitions
-                        unsafe {
+                        if let Err(e) = unsafe {
                             baked.encoder.begin_encoding(hal_label(
                                 Some("(wgpu internal) Transit"),
                                 device.instance_flags,
                             ))
                         }
-                        .map_err(|e| device.handle_hal_error(e))?;
+                        .map_err(|e| device.handle_hal_error(e))
+                        {
+                            break 'error Err(e.into());
+                        }
 
                         //Note: locking the trackers has to be done after the storages
                         let mut trackers = device.trackers.lock();
-                        baked.initialize_buffer_memory(&mut trackers, &snatch_guard)?;
-                        baked.initialize_texture_memory(&mut trackers, device, &snatch_guard)?;
+                        if let Err(e) = baked.initialize_buffer_memory(&mut trackers, &snatch_guard)
+                        {
+                            break 'error Err(e.into());
+                        }
+                        if let Err(e) =
+                            baked.initialize_texture_memory(&mut trackers, device, &snatch_guard)
+                        {
+                            break 'error Err(e.into());
+                        }
+
                         //Note: stateless trackers are not merged:
                         // device already knows these resources exist.
                         CommandBuffer::insert_barriers_from_device_tracker(
@@ -1147,13 +1160,16 @@ impl Global {
                         // Note: we could technically do it after all of the command buffers,
                         // but here we have a command encoder by hand, so it's easier to use it.
                         if !used_surface_textures.is_empty() {
-                            unsafe {
+                            if let Err(e) = unsafe {
                                 baked.encoder.begin_encoding(hal_label(
                                     Some("(wgpu internal) Present"),
                                     device.instance_flags,
                                 ))
                             }
-                            .map_err(|e| device.handle_hal_error(e))?;
+                            .map_err(|e| device.handle_hal_error(e))
+                            {
+                                break 'error Err(e.into());
+                            }
                             let texture_barriers = trackers
                                 .textures
                                 .set_from_usage_scope_and_drain_transitions(
@@ -1180,7 +1196,7 @@ impl Global {
                     }
 
                     if let Some(first_error) = first_error {
-                        return Err(first_error);
+                        break 'error Err(first_error);
                     }
                 }
             }
@@ -1190,9 +1206,9 @@ impl Global {
             {
                 used_surface_textures.set_size(hub.textures.read().len());
                 for texture in pending_writes.dst_textures.values() {
-                    match texture.try_inner(&snatch_guard)? {
-                        TextureInner::Native { .. } => {}
-                        TextureInner::Surface { .. } => {
+                    match texture.try_inner(&snatch_guard) {
+                        Ok(TextureInner::Native { .. }) => {}
+                        Ok(TextureInner::Surface { .. }) => {
                             // Compare the Arcs by pointer as Textures don't implement Eq
                             submit_surface_textures_owned
                                 .insert(Arc::as_ptr(texture), texture.clone());
@@ -1203,6 +1219,7 @@ impl Global {
                                     .unwrap()
                             };
                         }
+                        Err(e) => break 'error Err(e.into()),
                     }
                 }
 
@@ -1224,10 +1241,12 @@ impl Global {
                 }
             }
 
-            if let Some(pending_execution) =
-                pending_writes.pre_submit(&device.command_allocator, device, &queue)?
-            {
-                active_executions.insert(0, pending_execution);
+            match pending_writes.pre_submit(&device.command_allocator, device, &queue) {
+                Ok(Some(pending_execution)) => {
+                    active_executions.insert(0, pending_execution);
+                }
+                Ok(None) => {}
+                Err(e) => break 'error Err(e.into()),
             }
 
             let hal_command_buffers = active_executions
@@ -1249,14 +1268,17 @@ impl Global {
                     submit_surface_textures.push(raw);
                 }
 
-                unsafe {
+                if let Err(e) = unsafe {
                     queue.raw().submit(
                         &hal_command_buffers,
                         &submit_surface_textures,
                         (fence.as_mut(), submit_index),
                     )
                 }
-                .map_err(|e| device.handle_hal_error(e))?;
+                .map_err(|e| device.handle_hal_error(e))
+                {
+                    break 'error Err(e.into());
+                }
 
                 // Advance the successful submission index.
                 device
@@ -1280,12 +1302,19 @@ impl Global {
             let (closures, _) =
                 match device.maintain(fence_guard, wgt::Maintain::Poll, snatch_guard) {
                     Ok(closures) => closures,
-                    Err(WaitIdleError::Device(err)) => return Err(QueueSubmitError::Queue(err)),
-                    Err(WaitIdleError::StuckGpu) => return Err(QueueSubmitError::StuckGpu),
+                    Err(WaitIdleError::Device(err)) => {
+                        break 'error Err(QueueSubmitError::Queue(err))
+                    }
+                    Err(WaitIdleError::StuckGpu) => break 'error Err(QueueSubmitError::StuckGpu),
                     Err(WaitIdleError::WrongSubmissionIndex(..)) => unreachable!(),
                 };
 
-            (submit_index, closures)
+            Ok(closures)
+        };
+
+        let callbacks = match res {
+            Ok(ok) => ok,
+            Err(e) => return Err((submit_index, e)),
         };
 
         // the closures should execute with nothing locked!
diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs
index 6c3bfc5ed..9f0fc6773 100644
--- a/wgpu-hal/src/vulkan/device.rs
+++ b/wgpu-hal/src/vulkan/device.rs
@@ -2538,8 +2538,7 @@ impl super::DeviceShared {
                         }
                         None => {
                             crate::hal_usage_error(format!(
-                                "no signals reached value {}",
-                                wait_value
+                                "no signals reached value {wait_value}"
                             ));
                         }
                     }
diff --git a/wgpu-info/src/human.rs b/wgpu-info/src/human.rs
index 24eeec000..8bbd4c006 100644
--- a/wgpu-info/src/human.rs
+++ b/wgpu-info/src/human.rs
@@ -230,7 +230,7 @@ fn print_adapter(output: &mut impl io::Write, report: &AdapterReport, idx: usize
     for format in TEXTURE_FORMAT_LIST {
         let features = texture_format_features[&format];
         let format_name = texture::texture_format_name(format);
-        write!(output, "\t\t{format_name:>0$}", max_format_name_size)?;
+        write!(output, "\t\t{format_name:>max_format_name_size$}")?;
         for bit in wgpu::TextureUsages::all().iter() {
             write!(output, " │ ")?;
             if features.allowed_usages.contains(bit) {
@@ -259,7 +259,7 @@ fn print_adapter(output: &mut impl io::Write, report: &AdapterReport, idx: usize
         let features = texture_format_features[&format];
         let format_name = texture::texture_format_name(format);
 
-        write!(output, "\t\t{format_name:>0$}", max_format_name_size)?;
+        write!(output, "\t\t{format_name:>max_format_name_size$}")?;
         for bit in wgpu::TextureFormatFeatureFlags::all().iter() {
             write!(output, " │ ")?;
             if features.flags.contains(bit) {
diff --git a/wgpu-macros/src/lib.rs b/wgpu-macros/src/lib.rs
index 19eea678a..f8232c036 100644
--- a/wgpu-macros/src/lib.rs
+++ b/wgpu-macros/src/lib.rs
@@ -14,8 +14,8 @@ pub fn gpu_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
     let ident_str = ident.to_string();
     let ident_lower = ident_str.to_snake_case();
 
-    let register_test_name = Ident::new(&format!("{}_initializer", ident_lower), ident.span());
-    let test_name_webgl = Ident::new(&format!("{}_webgl", ident_lower), ident.span());
+    let register_test_name = Ident::new(&format!("{ident_lower}_initializer"), ident.span());
+    let test_name_webgl = Ident::new(&format!("{ident_lower}_webgl"), ident.span());
 
     quote! {
         #[cfg(not(target_arch = "wasm32"))]
diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs
index 3aac20e21..652df388f 100644
--- a/wgpu/src/backend/wgpu_core.rs
+++ b/wgpu/src/backend/wgpu_core.rs
@@ -359,7 +359,7 @@ impl ContextWgpuCore {
 
         print_tree(&mut output, &mut level, err);
 
-        format!("Validation Error\n\nCaused by:\n{}", output)
+        format!("Validation Error\n\nCaused by:\n{output}")
     }
 }
 
@@ -2074,7 +2074,10 @@ impl crate::Context for ContextWgpuCore {
 
         let index = match self.0.queue_submit(queue_data.id, &temp_command_buffers) {
             Ok(index) => index,
-            Err(err) => self.handle_error_fatal(err, "Queue::submit"),
+            Err((index, err)) => {
+                self.handle_error_nolabel(&queue_data.error_sink, err, "Queue::submit");
+                index
+            }
         };
 
         for cmdbuf in &temp_command_buffers {


Test patch:
diff --git a/player/tests/test.rs b/player/tests/test.rs
index ec96f5446..107481b74 100644
--- a/player/tests/test.rs
+++ b/player/tests/test.rs
@@ -58,7 +58,7 @@ struct Test<'a> {
 
 fn map_callback(status: Result<(), wgc::resource::BufferAccessError>) {
     if let Err(e) = status {
-        panic!("Buffer map error: {}", e);
+        panic!("Buffer map error: {e}");
     }
 }
 
@@ -88,7 +88,7 @@ impl Test<'_> {
             .iter()
             .map(|feature| {
                 wgt::Features::from_name(feature)
-                    .unwrap_or_else(|| panic!("Invalid feature flag {}", feature))
+                    .unwrap_or_else(|| panic!("Invalid feature flag {feature}"))
             })
             .fold(wgt::Features::empty(), |a, b| a | b);
         Test {
@@ -120,7 +120,7 @@ impl Test<'_> {
             Some(queue_id),
         );
         if let Err(e) = res {
-            panic!("{:?}", e);
+            panic!("{e:?}");
         }
 
         let mut command_buffer_id_manager = wgc::identity::IdentityManager::new();
@@ -186,8 +186,7 @@ impl Test<'_> {
 
             if &expected_data[..] != contents {
                 panic!(
-                    "Test expectation is not met!\nBuffer content was:\n{:?}\nbut expected:\n{:?}",
-                    contents, expected_data
+                    "Test expectation is not met!\nBuffer content was:\n{contents:?}\nbut expected:\n{expected_data:?}"
                 );
             }
         }
@@ -209,7 +208,7 @@ const BACKENDS: &[wgt::Backend] = &[
 
 impl Corpus {
     fn run_from(path: PathBuf) {
-        println!("Corpus {:?}", path);
+        println!("Corpus {path:?}");
         let dir = path.parent().unwrap();
         let corpus: Corpus = ron::de::from_reader(File::open(&path).unwrap()).unwrap();
 
@@ -219,7 +218,7 @@ impl Corpus {
             }
             let mut test_num = 0;
             for test_path in &corpus.tests {
-                println!("\t\tTest '{:?}'", test_path);
+                println!("\t\tTest '{test_path:?}'");
 
                 let global = wgc::global::Global::new(
                     "test",
@@ -243,7 +242,7 @@ impl Corpus {
                     Err(_) => continue,
                 };
 
-                println!("\tBackend {:?}", backend);
+                println!("\tBackend {backend:?}");
                 let supported_features = global.adapter_features(adapter);
                 let downlevel_caps = global.adapter_downlevel_capabilities(adapter);
 
diff --git a/tests/src/image.rs b/tests/src/image.rs
index 602d93c4e..f1fe07b10 100644
--- a/tests/src/image.rs
+++ b/tests/src/image.rs
@@ -188,11 +188,10 @@ pub async fn compare_image_output(
         sanitize_for_path(&adapter_info.driver)
     );
     // Determine the paths to write out the various intermediate files
-    let actual_path = Path::new(&path).with_file_name(
-        OsString::from_str(&format!("{}-{}-actual.png", file_stem, renderer)).unwrap(),
-    );
+    let actual_path = Path::new(&path)
+        .with_file_name(OsString::from_str(&format!("{file_stem}-{renderer}-actual.png")).unwrap());
     let difference_path = Path::new(&path).with_file_name(
-        OsString::from_str(&format!("{}-{}-difference.png", file_stem, renderer,)).unwrap(),
+        OsString::from_str(&format!("{file_stem}-{renderer}-difference.png",)).unwrap(),
     );
 
     let mut all_passed;
diff --git a/tests/src/params.rs b/tests/src/params.rs
index e5d50a485..d3b7070f3 100644
--- a/tests/src/params.rs
+++ b/tests/src/params.rs
@@ -151,7 +151,7 @@ impl TestInfo {
             let names: ArrayVec<_, 4> = reasons.iter_names().map(|(name, _)| name).collect();
             let names_text = names.join(" | ");
 
-            format!("Skipped Failure: {}", names_text)
+            format!("Skipped Failure: {names_text}")
         } else if !unsupported_reasons.is_empty() {
             skip = true;
             format!("Unsupported: {}", unsupported_reasons.join(" | "))
diff --git a/tests/tests/regression/issue_6317.rs b/tests/tests/regression/issue_6317.rs
new file mode 100644
index 000000000..20945006f
--- /dev/null
+++ b/tests/tests/regression/issue_6317.rs
@@ -0,0 +1,58 @@
+use wgpu::{DownlevelFlags, Limits};
+use wgpu_macros::gpu_test;
+use wgpu_test::{fail, GpuTestConfiguration, TestParameters};
+
+#[gpu_test]
+static NON_FATAL_ERRORS_IN_QUEUE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new()
+    .parameters(
+        TestParameters::default()
+            .downlevel_flags(DownlevelFlags::COMPUTE_SHADERS)
+            .limits(Limits::downlevel_defaults()),
+    )
+    .run_sync(|ctx| {
+        let shader_with_trivial_bind_group = concat!(
+            "@group(0) @binding(0) var<storage, read_write> stuff: u32;\n",
+            "\n",
+            "@compute @workgroup_size(1) fn main() { stuff = 2u; }\n"
+        );
+
+        let module = ctx
+            .device
+            .create_shader_module(wgpu::ShaderModuleDescriptor {
+                label: None,
+                source: wgpu::ShaderSource::Wgsl(shader_with_trivial_bind_group.into()),
+            });
+
+        let compute_pipeline =
+            ctx.device
+                .create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
+                    label: None,
+                    layout: None,
+                    module: &module,
+                    entry_point: None,
+                    compilation_options: Default::default(),
+                    cache: Default::default(),
+                });
+
+        fail(
+            &ctx.device,
+            || {
+                let mut command_encoder = ctx.device.create_command_encoder(&Default::default());
+                {
+                    let mut render_pass = command_encoder.begin_compute_pass(&Default::default());
+                    render_pass.set_pipeline(&compute_pipeline);
+
+                    // NOTE: We deliberately don't set a bind group here, to provoke a validation
+                    // error.
+
+                    render_pass.dispatch_workgroups(1, 1, 1);
+                }
+
+                let _idx = ctx.queue.submit([command_encoder.finish()]);
+            },
+            Some(concat!(
+                "The current set ComputePipeline with '' label ",
+                "expects a BindGroup to be set at index 0"
+            )),
+        )
+    });
diff --git a/tests/tests/root.rs b/tests/tests/root.rs
index df0dce5fe..3bb8e14a9 100644
--- a/tests/tests/root.rs
+++ b/tests/tests/root.rs
@@ -6,6 +6,7 @@ mod regression {
     mod issue_4485;
     mod issue_4514;
     mod issue_5553;
+    mod issue_6317;
 }
 
 mod bgra8unorm_storage;
diff --git a/tests/tests/subgroup_operations/mod.rs b/tests/tests/subgroup_operations/mod.rs
index ecf8adfd7..f874a6bac 100644
--- a/tests/tests/subgroup_operations/mod.rs
+++ b/tests/tests/subgroup_operations/mod.rs
@@ -123,10 +123,10 @@ static SUBGROUP_OPERATIONS: GpuTestConfiguration = GpuTestConfiguration::new()
                         .enumerate()
                         .filter(|(_, (r, e))| *r != e)
                     {
-                        write!(&mut msg, "thread {} failed tests:", thread).unwrap();
+                        write!(&mut msg, "thread {thread} failed tests:").unwrap();
                         let difference = result ^ expected;
                         for i in (0..u32::BITS).filter(|i| (difference & (1 << i)) != 0) {
-                            write!(&mut msg, " {},", i).unwrap();
+                            write!(&mut msg, " {i},").unwrap();
                         }
                         writeln!(&mut msg).unwrap();
                     }
diff --git a/tests/tests/vertex_formats/mod.rs b/tests/tests/vertex_formats/mod.rs
index d447ac8f7..189120d4a 100644
--- a/tests/tests/vertex_formats/mod.rs
+++ b/tests/tests/vertex_formats/mod.rs
@@ -352,10 +352,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) {
 
         let mut deltas = data.iter().zip(expected.iter()).map(|(d, e)| (d - e).abs());
         if deltas.any(|x| x > EPSILON) {
-            eprintln!(
-                "Failed: Got: {:?} Expected: {:?} - {case_name}",
-                data, expected,
-            );
+            eprintln!("Failed: Got: {data:?} Expected: {expected:?} - {case_name}",);
             failed = true;
             continue;
         }
diff --git a/tests/tests/vertex_indices/mod.rs b/tests/tests/vertex_indices/mod.rs
index 5c5ce8a20..300a97eeb 100644
--- a/tests/tests/vertex_indices/mod.rs
+++ b/tests/tests/vertex_indices/mod.rs
@@ -471,10 +471,7 @@ async fn vertex_index_common(ctx: TestingContext) {
             test.case, test.id_source, test.draw_call_kind, test.encoder_kind
         );
         if data != expected {
-            eprintln!(
-                "Failed: Got: {:?} Expected: {:?} - {case_name}",
-                data, expected,
-            );
+            eprintln!("Failed: Got: {data:?} Expected: {expected:?} - {case_name}",);
             failed = true;
         } else {
             eprintln!("Passed: {case_name}");