Skip to content

Commit 22dddc6

Browse files
committed
Sort Unix env constants alphabetically by target_os
They were roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.
1 parent f433fa4 commit 22dddc6

File tree

1 file changed

+102
-98
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+102
-98
lines changed

library/std/src/sys/pal/unix/env.rs

+102-98
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,119 @@
1-
#[cfg(target_os = "linux")]
2-
pub mod os {
3-
pub const FAMILY: &str = "unix";
4-
pub const OS: &str = "linux";
5-
pub const DLL_PREFIX: &str = "lib";
6-
pub const DLL_SUFFIX: &str = ".so";
7-
pub const DLL_EXTENSION: &str = "so";
8-
pub const EXE_SUFFIX: &str = "";
9-
pub const EXE_EXTENSION: &str = "";
10-
}
1+
// Keep entries sorted alphabetically.
112

12-
#[cfg(target_os = "macos")]
3+
#[cfg(target_os = "aix")]
134
pub mod os {
145
pub const FAMILY: &str = "unix";
15-
pub const OS: &str = "macos";
6+
pub const OS: &str = "aix";
167
pub const DLL_PREFIX: &str = "lib";
17-
pub const DLL_SUFFIX: &str = ".dylib";
18-
pub const DLL_EXTENSION: &str = "dylib";
8+
pub const DLL_SUFFIX: &str = ".a";
9+
pub const DLL_EXTENSION: &str = "a";
1910
pub const EXE_SUFFIX: &str = "";
2011
pub const EXE_EXTENSION: &str = "";
2112
}
2213

23-
#[cfg(target_os = "ios")]
14+
#[cfg(target_os = "android")]
2415
pub mod os {
2516
pub const FAMILY: &str = "unix";
26-
pub const OS: &str = "ios";
17+
pub const OS: &str = "android";
2718
pub const DLL_PREFIX: &str = "lib";
28-
pub const DLL_SUFFIX: &str = ".dylib";
29-
pub const DLL_EXTENSION: &str = "dylib";
19+
pub const DLL_SUFFIX: &str = ".so";
20+
pub const DLL_EXTENSION: &str = "so";
3021
pub const EXE_SUFFIX: &str = "";
3122
pub const EXE_EXTENSION: &str = "";
3223
}
3324

34-
#[cfg(target_os = "tvos")]
25+
#[cfg(target_os = "cygwin")]
3526
pub mod os {
3627
pub const FAMILY: &str = "unix";
37-
pub const OS: &str = "tvos";
38-
pub const DLL_PREFIX: &str = "lib";
39-
pub const DLL_SUFFIX: &str = ".dylib";
40-
pub const DLL_EXTENSION: &str = "dylib";
41-
pub const EXE_SUFFIX: &str = "";
42-
pub const EXE_EXTENSION: &str = "";
28+
pub const OS: &str = "cygwin";
29+
pub const DLL_PREFIX: &str = "";
30+
pub const DLL_SUFFIX: &str = ".dll";
31+
pub const DLL_EXTENSION: &str = "dll";
32+
pub const EXE_SUFFIX: &str = ".exe";
33+
pub const EXE_EXTENSION: &str = "exe";
4334
}
4435

45-
#[cfg(target_os = "watchos")]
36+
#[cfg(target_os = "dragonfly")]
4637
pub mod os {
4738
pub const FAMILY: &str = "unix";
48-
pub const OS: &str = "watchos";
39+
pub const OS: &str = "dragonfly";
4940
pub const DLL_PREFIX: &str = "lib";
50-
pub const DLL_SUFFIX: &str = ".dylib";
51-
pub const DLL_EXTENSION: &str = "dylib";
41+
pub const DLL_SUFFIX: &str = ".so";
42+
pub const DLL_EXTENSION: &str = "so";
5243
pub const EXE_SUFFIX: &str = "";
5344
pub const EXE_EXTENSION: &str = "";
5445
}
5546

56-
#[cfg(target_os = "visionos")]
47+
#[cfg(all(target_os = "emscripten", target_arch = "wasm32"))]
5748
pub mod os {
5849
pub const FAMILY: &str = "unix";
59-
pub const OS: &str = "visionos";
50+
pub const OS: &str = "emscripten";
6051
pub const DLL_PREFIX: &str = "lib";
61-
pub const DLL_SUFFIX: &str = ".dylib";
62-
pub const DLL_EXTENSION: &str = "dylib";
63-
pub const EXE_SUFFIX: &str = "";
64-
pub const EXE_EXTENSION: &str = "";
52+
pub const DLL_SUFFIX: &str = ".so";
53+
pub const DLL_EXTENSION: &str = "so";
54+
pub const EXE_SUFFIX: &str = ".js";
55+
pub const EXE_EXTENSION: &str = "js";
6556
}
6657

67-
#[cfg(target_os = "freebsd")]
58+
#[cfg(target_os = "espidf")]
6859
pub mod os {
6960
pub const FAMILY: &str = "unix";
70-
pub const OS: &str = "freebsd";
61+
pub const OS: &str = "espidf";
7162
pub const DLL_PREFIX: &str = "lib";
7263
pub const DLL_SUFFIX: &str = ".so";
7364
pub const DLL_EXTENSION: &str = "so";
7465
pub const EXE_SUFFIX: &str = "";
7566
pub const EXE_EXTENSION: &str = "";
7667
}
7768

78-
#[cfg(target_os = "dragonfly")]
69+
#[cfg(target_os = "freebsd")]
7970
pub mod os {
8071
pub const FAMILY: &str = "unix";
81-
pub const OS: &str = "dragonfly";
72+
pub const OS: &str = "freebsd";
8273
pub const DLL_PREFIX: &str = "lib";
8374
pub const DLL_SUFFIX: &str = ".so";
8475
pub const DLL_EXTENSION: &str = "so";
8576
pub const EXE_SUFFIX: &str = "";
8677
pub const EXE_EXTENSION: &str = "";
8778
}
8879

89-
#[cfg(target_os = "netbsd")]
80+
#[cfg(target_os = "fuchsia")]
9081
pub mod os {
9182
pub const FAMILY: &str = "unix";
92-
pub const OS: &str = "netbsd";
83+
pub const OS: &str = "fuchsia";
9384
pub const DLL_PREFIX: &str = "lib";
9485
pub const DLL_SUFFIX: &str = ".so";
9586
pub const DLL_EXTENSION: &str = "so";
9687
pub const EXE_SUFFIX: &str = "";
9788
pub const EXE_EXTENSION: &str = "";
9889
}
9990

100-
#[cfg(target_os = "openbsd")]
91+
#[cfg(target_os = "haiku")]
10192
pub mod os {
10293
pub const FAMILY: &str = "unix";
103-
pub const OS: &str = "openbsd";
94+
pub const OS: &str = "haiku";
10495
pub const DLL_PREFIX: &str = "lib";
10596
pub const DLL_SUFFIX: &str = ".so";
10697
pub const DLL_EXTENSION: &str = "so";
10798
pub const EXE_SUFFIX: &str = "";
10899
pub const EXE_EXTENSION: &str = "";
109100
}
110101

111-
#[cfg(target_os = "cygwin")]
112-
pub mod os {
113-
pub const FAMILY: &str = "unix";
114-
pub const OS: &str = "cygwin";
115-
pub const DLL_PREFIX: &str = "";
116-
pub const DLL_SUFFIX: &str = ".dll";
117-
pub const DLL_EXTENSION: &str = "dll";
118-
pub const EXE_SUFFIX: &str = ".exe";
119-
pub const EXE_EXTENSION: &str = "exe";
120-
}
121-
122-
#[cfg(target_os = "android")]
102+
#[cfg(target_os = "horizon")]
123103
pub mod os {
124104
pub const FAMILY: &str = "unix";
125-
pub const OS: &str = "android";
105+
pub const OS: &str = "horizon";
126106
pub const DLL_PREFIX: &str = "lib";
127107
pub const DLL_SUFFIX: &str = ".so";
128108
pub const DLL_EXTENSION: &str = "so";
129-
pub const EXE_SUFFIX: &str = "";
130-
pub const EXE_EXTENSION: &str = "";
109+
pub const EXE_SUFFIX: &str = ".elf";
110+
pub const EXE_EXTENSION: &str = "elf";
131111
}
132112

133-
#[cfg(target_os = "solaris")]
113+
#[cfg(target_os = "hurd")]
134114
pub mod os {
135115
pub const FAMILY: &str = "unix";
136-
pub const OS: &str = "solaris";
116+
pub const OS: &str = "hurd";
137117
pub const DLL_PREFIX: &str = "lib";
138118
pub const DLL_SUFFIX: &str = ".so";
139119
pub const DLL_EXTENSION: &str = "so";
@@ -152,87 +132,87 @@ pub mod os {
152132
pub const EXE_EXTENSION: &str = "";
153133
}
154134

155-
#[cfg(target_os = "haiku")]
135+
#[cfg(target_os = "ios")]
156136
pub mod os {
157137
pub const FAMILY: &str = "unix";
158-
pub const OS: &str = "haiku";
138+
pub const OS: &str = "ios";
159139
pub const DLL_PREFIX: &str = "lib";
160-
pub const DLL_SUFFIX: &str = ".so";
161-
pub const DLL_EXTENSION: &str = "so";
140+
pub const DLL_SUFFIX: &str = ".dylib";
141+
pub const DLL_EXTENSION: &str = "dylib";
162142
pub const EXE_SUFFIX: &str = "";
163143
pub const EXE_EXTENSION: &str = "";
164144
}
165145

166-
#[cfg(target_os = "horizon")]
146+
#[cfg(target_os = "l4re")]
167147
pub mod os {
168148
pub const FAMILY: &str = "unix";
169-
pub const OS: &str = "horizon";
149+
pub const OS: &str = "l4re";
170150
pub const DLL_PREFIX: &str = "lib";
171151
pub const DLL_SUFFIX: &str = ".so";
172152
pub const DLL_EXTENSION: &str = "so";
173-
pub const EXE_SUFFIX: &str = ".elf";
174-
pub const EXE_EXTENSION: &str = "elf";
153+
pub const EXE_SUFFIX: &str = "";
154+
pub const EXE_EXTENSION: &str = "";
175155
}
176156

177-
#[cfg(target_os = "hurd")]
157+
#[cfg(target_os = "linux")]
178158
pub mod os {
179159
pub const FAMILY: &str = "unix";
180-
pub const OS: &str = "hurd";
160+
pub const OS: &str = "linux";
181161
pub const DLL_PREFIX: &str = "lib";
182162
pub const DLL_SUFFIX: &str = ".so";
183163
pub const DLL_EXTENSION: &str = "so";
184164
pub const EXE_SUFFIX: &str = "";
185165
pub const EXE_EXTENSION: &str = "";
186166
}
187167

188-
#[cfg(target_os = "vita")]
168+
#[cfg(target_os = "macos")]
189169
pub mod os {
190170
pub const FAMILY: &str = "unix";
191-
pub const OS: &str = "vita";
171+
pub const OS: &str = "macos";
192172
pub const DLL_PREFIX: &str = "lib";
193-
pub const DLL_SUFFIX: &str = ".so";
194-
pub const DLL_EXTENSION: &str = "so";
195-
pub const EXE_SUFFIX: &str = ".elf";
196-
pub const EXE_EXTENSION: &str = "elf";
173+
pub const DLL_SUFFIX: &str = ".dylib";
174+
pub const DLL_EXTENSION: &str = "dylib";
175+
pub const EXE_SUFFIX: &str = "";
176+
pub const EXE_EXTENSION: &str = "";
197177
}
198178

199-
#[cfg(all(target_os = "emscripten", target_arch = "wasm32"))]
179+
#[cfg(target_os = "netbsd")]
200180
pub mod os {
201181
pub const FAMILY: &str = "unix";
202-
pub const OS: &str = "emscripten";
182+
pub const OS: &str = "netbsd";
203183
pub const DLL_PREFIX: &str = "lib";
204184
pub const DLL_SUFFIX: &str = ".so";
205185
pub const DLL_EXTENSION: &str = "so";
206-
pub const EXE_SUFFIX: &str = ".js";
207-
pub const EXE_EXTENSION: &str = "js";
186+
pub const EXE_SUFFIX: &str = "";
187+
pub const EXE_EXTENSION: &str = "";
208188
}
209189

210-
#[cfg(target_os = "fuchsia")]
190+
#[cfg(target_os = "nto")]
211191
pub mod os {
212192
pub const FAMILY: &str = "unix";
213-
pub const OS: &str = "fuchsia";
193+
pub const OS: &str = "nto";
214194
pub const DLL_PREFIX: &str = "lib";
215195
pub const DLL_SUFFIX: &str = ".so";
216196
pub const DLL_EXTENSION: &str = "so";
217197
pub const EXE_SUFFIX: &str = "";
218198
pub const EXE_EXTENSION: &str = "";
219199
}
220200

221-
#[cfg(target_os = "l4re")]
201+
#[cfg(target_os = "nuttx")]
222202
pub mod os {
223203
pub const FAMILY: &str = "unix";
224-
pub const OS: &str = "l4re";
204+
pub const OS: &str = "nuttx";
225205
pub const DLL_PREFIX: &str = "lib";
226206
pub const DLL_SUFFIX: &str = ".so";
227207
pub const DLL_EXTENSION: &str = "so";
228208
pub const EXE_SUFFIX: &str = "";
229209
pub const EXE_EXTENSION: &str = "";
230210
}
231211

232-
#[cfg(target_os = "nto")]
212+
#[cfg(target_os = "openbsd")]
233213
pub mod os {
234214
pub const FAMILY: &str = "unix";
235-
pub const OS: &str = "nto";
215+
pub const OS: &str = "openbsd";
236216
pub const DLL_PREFIX: &str = "lib";
237217
pub const DLL_SUFFIX: &str = ".so";
238218
pub const DLL_EXTENSION: &str = "so";
@@ -262,46 +242,70 @@ pub mod os {
262242
pub const EXE_EXTENSION: &str = "";
263243
}
264244

265-
#[cfg(target_os = "vxworks")]
245+
#[cfg(target_os = "solaris")]
266246
pub mod os {
267247
pub const FAMILY: &str = "unix";
268-
pub const OS: &str = "vxworks";
248+
pub const OS: &str = "solaris";
269249
pub const DLL_PREFIX: &str = "lib";
270250
pub const DLL_SUFFIX: &str = ".so";
271251
pub const DLL_EXTENSION: &str = "so";
272252
pub const EXE_SUFFIX: &str = "";
273253
pub const EXE_EXTENSION: &str = "";
274254
}
275255

276-
#[cfg(target_os = "espidf")]
256+
#[cfg(target_os = "tvos")]
277257
pub mod os {
278258
pub const FAMILY: &str = "unix";
279-
pub const OS: &str = "espidf";
259+
pub const OS: &str = "tvos";
280260
pub const DLL_PREFIX: &str = "lib";
281-
pub const DLL_SUFFIX: &str = ".so";
282-
pub const DLL_EXTENSION: &str = "so";
261+
pub const DLL_SUFFIX: &str = ".dylib";
262+
pub const DLL_EXTENSION: &str = "dylib";
283263
pub const EXE_SUFFIX: &str = "";
284264
pub const EXE_EXTENSION: &str = "";
285265
}
286266

287-
#[cfg(target_os = "aix")]
267+
#[cfg(target_os = "visionos")]
288268
pub mod os {
289269
pub const FAMILY: &str = "unix";
290-
pub const OS: &str = "aix";
270+
pub const OS: &str = "visionos";
291271
pub const DLL_PREFIX: &str = "lib";
292-
pub const DLL_SUFFIX: &str = ".a";
293-
pub const DLL_EXTENSION: &str = "a";
272+
pub const DLL_SUFFIX: &str = ".dylib";
273+
pub const DLL_EXTENSION: &str = "dylib";
294274
pub const EXE_SUFFIX: &str = "";
295275
pub const EXE_EXTENSION: &str = "";
296276
}
297277

298-
#[cfg(target_os = "nuttx")]
278+
#[cfg(target_os = "vita")]
299279
pub mod os {
300280
pub const FAMILY: &str = "unix";
301-
pub const OS: &str = "nuttx";
281+
pub const OS: &str = "vita";
282+
pub const DLL_PREFIX: &str = "lib";
283+
pub const DLL_SUFFIX: &str = ".so";
284+
pub const DLL_EXTENSION: &str = "so";
285+
pub const EXE_SUFFIX: &str = ".elf";
286+
pub const EXE_EXTENSION: &str = "elf";
287+
}
288+
289+
#[cfg(target_os = "vxworks")]
290+
pub mod os {
291+
pub const FAMILY: &str = "unix";
292+
pub const OS: &str = "vxworks";
302293
pub const DLL_PREFIX: &str = "lib";
303294
pub const DLL_SUFFIX: &str = ".so";
304295
pub const DLL_EXTENSION: &str = "so";
305296
pub const EXE_SUFFIX: &str = "";
306297
pub const EXE_EXTENSION: &str = "";
307298
}
299+
300+
#[cfg(target_os = "watchos")]
301+
pub mod os {
302+
pub const FAMILY: &str = "unix";
303+
pub const OS: &str = "watchos";
304+
pub const DLL_PREFIX: &str = "lib";
305+
pub const DLL_SUFFIX: &str = ".dylib";
306+
pub const DLL_EXTENSION: &str = "dylib";
307+
pub const EXE_SUFFIX: &str = "";
308+
pub const EXE_EXTENSION: &str = "";
309+
}
310+
311+
// Keep entries sorted alphabetically.

0 commit comments

Comments
 (0)