@@ -25,14 +25,13 @@ mod mystd {
2525#[ cfg( not( backtrace_in_libstd) ) ]
2626extern crate std as mystd;
2727
28- cfg_if :: cfg_if ! {
29- if # [ cfg ( windows) ] {
28+ cfg_select ! {
29+ windows => {
3030 #[ path = "gimli/mmap_windows.rs" ]
3131 mod mmap;
32- } else if #[ cfg( target_vendor = "apple" ) ] {
33- #[ path = "gimli/mmap_unix.rs" ]
34- mod mmap;
35- } else if #[ cfg( any(
32+ }
33+ any(
34+ target_vendor = "apple" ,
3635 target_os = "android" ,
3736 target_os = "freebsd" ,
3837 target_os = "fuchsia" ,
@@ -44,10 +43,11 @@ cfg_if::cfg_if! {
4443 target_os = "illumos" ,
4544 target_os = "aix" ,
4645 target_os = "cygwin" ,
47- ) ) ] {
46+ ) => {
4847 #[ path = "gimli/mmap_unix.rs" ]
4948 mod mmap;
50- } else {
49+ }
50+ _ => {
5151 #[ path = "gimli/mmap_fake.rs" ]
5252 mod mmap;
5353 }
@@ -195,33 +195,39 @@ fn mmap(path: &Path) -> Option<Mmap> {
195195 unsafe { Mmap :: map ( & file, len, 0 ) }
196196}
197197
198- cfg_if :: cfg_if ! {
199- if # [ cfg ( any( windows, target_os = "cygwin" ) ) ] {
198+ cfg_select ! {
199+ any( windows, target_os = "cygwin" ) => {
200200 mod coff;
201201 use self :: coff:: { handle_split_dwarf, Object } ;
202- } else if #[ cfg( any( target_vendor = "apple" ) ) ] {
202+ }
203+ target_vendor = "apple" => {
203204 mod macho;
204205 use self :: macho:: { handle_split_dwarf, Object } ;
205- } else if #[ cfg( target_os = "aix" ) ] {
206+ }
207+ target_os = "aix" => {
206208 mod xcoff;
207209 use self :: xcoff:: { handle_split_dwarf, Object } ;
208- } else {
210+ }
211+ _ => {
209212 mod elf;
210213 use self :: elf:: { handle_split_dwarf, Object } ;
211214 }
212215}
213216
214- cfg_if :: cfg_if ! {
215- if # [ cfg ( any( windows, target_os = "cygwin" ) ) ] {
217+ cfg_select ! {
218+ any( windows, target_os = "cygwin" ) => {
216219 mod libs_windows;
217220 use libs_windows:: native_libraries;
218- } else if #[ cfg( target_vendor = "apple" ) ] {
221+ }
222+ target_vendor = "apple" => {
219223 mod libs_macos;
220224 use libs_macos:: native_libraries;
221- } else if #[ cfg( target_os = "illumos" ) ] {
225+ }
226+ target_os = "illumos" => {
222227 mod libs_illumos;
223228 use libs_illumos:: native_libraries;
224- } else if #[ cfg( all(
229+ }
230+ all(
225231 any(
226232 target_os = "linux" ,
227233 target_os = "fuchsia" ,
@@ -233,22 +239,26 @@ cfg_if::cfg_if! {
233239 target_os = "android" ,
234240 ) ,
235241 not( target_env = "uclibc" ) ,
236- ) ) ] {
242+ ) => {
237243 mod libs_dl_iterate_phdr;
238244 use libs_dl_iterate_phdr:: native_libraries;
239245 #[ path = "gimli/parse_running_mmaps_unix.rs" ]
240246 mod parse_running_mmaps;
241- } else if #[ cfg( target_env = "libnx" ) ] {
247+ }
248+ target_env = "libnx" => {
242249 mod libs_libnx;
243250 use libs_libnx:: native_libraries;
244- } else if #[ cfg( target_os = "haiku" ) ] {
251+ }
252+ target_os = "haiku" => {
245253 mod libs_haiku;
246254 use libs_haiku:: native_libraries;
247- } else if #[ cfg( target_os = "aix" ) ] {
255+ }
256+ target_os = "aix" => {
248257 mod libs_aix;
249258 use libs_aix:: native_libraries;
250- } else {
251- // Everything else should doesn't know how to load native libraries.
259+ }
260+ _ => {
261+ // Everything else doesn't know how to load native libraries.
252262 fn native_libraries( ) -> Vec <Library > {
253263 Vec :: new( )
254264 }
@@ -316,12 +326,14 @@ struct LibrarySegment {
316326}
317327
318328fn create_mapping ( lib : & Library ) -> Option < Mapping > {
319- cfg_if :: cfg_if ! {
320- if # [ cfg ( target_os = "aix" ) ] {
329+ cfg_select ! {
330+ target_os = "aix" => {
321331 Mapping :: new( lib. name. as_ref( ) , & lib. member_name)
322- } else if #[ cfg( target_os = "android" ) ] {
332+ }
333+ target_os = "android" => {
323334 Mapping :: new_android( lib. name. as_ref( ) , lib. zip_offset)
324- } else {
335+ }
336+ _ => {
325337 Mapping :: new( lib. name. as_ref( ) )
326338 }
327339 }
0 commit comments