Global init remove dummy argument (#3101)

This commit is contained in:
Jim Blandy 2022-10-13 14:41:58 -07:00 committed by GitHub
parent d1ff3838b8
commit b28a87e298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -448,12 +448,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
) -> SurfaceId {
profiling::scope!("Instance::create_surface");
// Note: using a dummy argument to work around the following
// error:
// > cannot provide explicit generic arguments when `impl Trait` is used in argument position
fn init<A: hal::Api>(
_: A,
inst: &Option<A::Instance>,
display_handle: raw_window_handle::RawDisplayHandle,
window_handle: raw_window_handle::RawWindowHandle,
@ -475,40 +470,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let surface = Surface {
presentation: None,
#[cfg(vulkan)]
vulkan: init(
hal::api::Vulkan,
&self.instance.vulkan,
display_handle,
window_handle,
),
vulkan: init::<hal::api::Vulkan>(&self.instance.vulkan, display_handle, window_handle),
#[cfg(metal)]
metal: init(
hal::api::Metal,
&self.instance.metal,
display_handle,
window_handle,
),
metal: init::<hal::api::Metal>(&self.instance.metal, display_handle, window_handle),
#[cfg(dx12)]
dx12: init(
hal::api::Dx12,
&self.instance.dx12,
display_handle,
window_handle,
),
dx12: init::<hal::api::Dx12>(&self.instance.dx12, display_handle, window_handle),
#[cfg(dx11)]
dx11: init(
hal::api::Dx11,
&self.instance.dx11,
display_handle,
window_handle,
),
dx11: init::<hal::api::Dx11>(&self.instance.dx11, display_handle, window_handle),
#[cfg(gl)]
gl: init(
hal::api::Gles,
&self.instance.gl,
display_handle,
window_handle,
),
gl: init::<hal::api::Gles>(&self.instance.gl, display_handle, window_handle),
};
let mut token = Token::root();