Skip to content

Commit

Permalink
Use fully qualified syntax for some calls.
Browse files Browse the repository at this point in the history
Without this change, rust-analyzer cannot determine the type of
cmd_buf.
  • Loading branch information
jimblandy committed May 13, 2022
1 parent c1934dc commit 7746829
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (device_guard, mut token) = hub.devices.read(&mut token);

let (mut cmd_buf_guard, mut token) = hub.command_buffers.write(&mut token);
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)
.map_pass_err(init_scope)?;
let result = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id);
// Call using fully qualified syntax, to placate rust-analyzer.
let cmd_buf = MapPassErr::<&mut CommandBuffer<A>, _>::map_pass_err(result, init_scope)?;
// will be reset to true if recording is done without errors
cmd_buf.status = CommandEncoderStatus::Error;
let raw = cmd_buf.encoder.open();
Expand Down
5 changes: 3 additions & 2 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (trackers, query_reset_state, pending_discard_init_fixups) = {
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);

let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmb_guard, encoder_id)
.map_pass_err(init_scope)?;
let result = CommandBuffer::get_encoder_mut(&mut *cmb_guard, encoder_id);
// Call using fully qualified syntax, to placate rust-analyzer.
let cmd_buf = MapPassErr::<&mut CommandBuffer<A>, _>::map_pass_err(result, init_scope)?;
// close everything while the new command encoder is filled
cmd_buf.encoder.close();
// will be reset to true if recording is done without errors
Expand Down

0 comments on commit 7746829

Please sign in to comment.