File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -5,20 +5,23 @@ use crate::Backends;
5
5
6
6
/// Initialize the adapter obeying the `WGPU_ADAPTER_NAME` environment variable.
7
7
#[ cfg( wgpu_core) ]
8
+ #[ cfg_attr( not( std) , expect( unused_variables, unreachable_code) ) ]
8
9
pub fn initialize_adapter_from_env (
9
10
instance : & Instance ,
10
11
compatible_surface : Option < & Surface < ' _ > > ,
11
12
) -> Result < Adapter , wgt:: RequestAdapterError > {
12
- cfg_if:: cfg_if! {
13
- if #[ cfg( std) ] {
14
- let desired_adapter_name = std:: env:: var( "WGPU_ADAPTER_NAME" )
15
- . as_deref( )
16
- . map( str :: to_lowercase)
17
- . map_err( |_| wgt:: RequestAdapterError :: EnvNotSet ) ?;
18
- } else {
19
- return Err ( wgt:: RequestAdapterError :: EnvNotSet ) ;
13
+ let desired_adapter_name: alloc:: string:: String = {
14
+ cfg_if:: cfg_if! {
15
+ if #[ cfg( std) ] {
16
+ std:: env:: var( "WGPU_ADAPTER_NAME" )
17
+ . as_deref( )
18
+ . map( str :: to_lowercase)
19
+ . map_err( |_| wgt:: RequestAdapterError :: EnvNotSet ) ?
20
+ } else {
21
+ return Err ( wgt:: RequestAdapterError :: EnvNotSet )
22
+ }
20
23
}
21
- }
24
+ } ;
22
25
23
26
let adapters = instance. enumerate_adapters ( crate :: Backends :: all ( ) ) ;
24
27
You can’t perform that action at this time.
0 commit comments