Skip to content

Commit 99a9460

Browse files
committed
x.py fmt cleanup
1 parent 48edfc7 commit 99a9460

File tree

13 files changed

+61
-62
lines changed

13 files changed

+61
-62
lines changed

library/std/src/os/custom/mod.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! This is primarily geared toward experimental platforms such
99
//! as new kernels and bare-bones environments, where you might
10-
//! want to use the standard library without recompiling
10+
//! want to use the standard library without recompiling
1111
//! everything or adding support upstream.
1212
//!
1313
//! # Initial state
@@ -77,7 +77,7 @@ macro_rules! static_rwlock_box_impl {
7777
let new_impl = transition(maybe_impl);
7878
*writer = Some(new_impl);
7979
}
80-
}
80+
};
8181
}
8282

8383
/// Platform-specific allocator
@@ -93,14 +93,14 @@ pub mod alloc {
9393

9494
/// Platform-specific interface to a filesystem
9595
pub mod fs {
96-
use crate::sync::RwLock;
97-
use crate::path::{Path, PathBuf};
9896
use crate::io;
97+
use crate::path::{Path, PathBuf};
98+
use crate::sync::RwLock;
9999

100100
#[doc(inline)]
101101
pub use crate::sys::fs::{
102-
File, FileAttr, ReadDir, ReadDirApi, FileApi, DirEntry,
103-
FilePermissions, OpenOptions, FileTimes, FileType,
102+
DirEntry, File, FileApi, FileAttr, FilePermissions, FileTimes, FileType, OpenOptions,
103+
ReadDir, ReadDirApi,
104104
};
105105

106106
static_rwlock_box_impl!(FilesystemInterface);
@@ -158,38 +158,41 @@ pub mod futex {
158158

159159
/// Platform-specific interface to a network
160160
pub mod net {
161-
use crate::sync::RwLock;
161+
use crate::io;
162162
use crate::net::SocketAddr;
163+
use crate::sync::RwLock;
163164
use crate::time::Duration;
164-
use crate::io;
165165

166166
#[doc(inline)]
167167
pub use crate::sys::net::{
168-
TcpStreamApi, TcpListenerApi, UdpSocketApi,
169-
TcpStream, TcpListener, UdpSocket, LookupHost,
168+
LookupHost, TcpListener, TcpListenerApi, TcpStream, TcpStreamApi, UdpSocket, UdpSocketApi,
170169
};
171170

172171
static_rwlock_box_impl!(NetworkInterface);
173172

174173
/// Platform-specific interface to a network
175174
pub trait NetworkInterface: Send + Sync {
176-
fn tcp_connect(&self, addr: &SocketAddr, timeout: Option<Duration>) -> io::Result<TcpStream>;
177-
fn tcp_bind (&self, addr: &SocketAddr) -> io::Result<TcpListener>;
178-
fn udp_bind (&self, addr: &SocketAddr) -> io::Result<UdpSocket>;
179-
fn lookup_str (&self, v: &str) -> io::Result<LookupHost>;
175+
fn tcp_connect(
176+
&self,
177+
addr: &SocketAddr,
178+
timeout: Option<Duration>,
179+
) -> io::Result<TcpStream>;
180+
fn tcp_bind(&self, addr: &SocketAddr) -> io::Result<TcpListener>;
181+
fn udp_bind(&self, addr: &SocketAddr) -> io::Result<UdpSocket>;
182+
fn lookup_str(&self, v: &str) -> io::Result<LookupHost>;
180183
fn lookup_tuple(&self, v: (&str, u16)) -> io::Result<LookupHost>;
181184
}
182185
}
183186

184187
/// Platform-specific interface to the running operating system
185188
pub mod os {
186189
use crate::ffi::{OsStr, OsString};
190+
use crate::io;
187191
use crate::path::{Path, PathBuf};
188192
use crate::sync::RwLock;
189-
use crate::io;
190193

191194
#[doc(inline)]
192-
pub use crate::sys::os::{Variable, Env, SplitPaths, JoinPathsError};
195+
pub use crate::sys::os::{Env, JoinPathsError, SplitPaths, Variable};
193196

194197
static_rwlock_box_impl!(Os);
195198

@@ -220,17 +223,14 @@ pub mod os {
220223

221224
/// Platform-specific management of processes
222225
pub mod process {
223-
use crate::sync::RwLock;
224226
use crate::io;
227+
use crate::sync::RwLock;
225228

226229
#[doc(inline)]
227230
pub use crate::sys_common::process::{CommandEnv, CommandEnvs};
228231

229232
#[doc(inline)]
230-
pub use crate::sys::process::{
231-
Command, Process, ProcessApi,
232-
ExitStatus, Stdio, StdioPipes,
233-
};
233+
pub use crate::sys::process::{Command, ExitStatus, Process, ProcessApi, Stdio, StdioPipes};
234234

235235
static_rwlock_box_impl!(ProcessManager);
236236

@@ -242,8 +242,8 @@ pub mod process {
242242

243243
/// Platform-specific standard IO interface
244244
pub mod stdio {
245-
use crate::sync::RwLock;
246245
use crate::io;
246+
use crate::sync::RwLock;
247247

248248
static_rwlock_box_impl!(StdioInterface);
249249

@@ -261,11 +261,11 @@ pub mod stdio {
261261

262262
/// Platform-specific management of threads
263263
pub mod thread {
264-
use crate::sync::RwLock;
265264
use crate::ffi::CStr;
265+
use crate::io;
266266
use crate::num::NonZeroUsize;
267+
use crate::sync::RwLock;
267268
use crate::time::Duration;
268-
use crate::io;
269269

270270
#[doc(inline)]
271271
pub use crate::sys::thread::{Thread, ThreadApi};

library/std/src/os/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod raw;
2525
))]
2626
#[unstable(issue = "none", feature = "std_internals")]
2727
#[path = "fake_unix_windows.rs"]
28-
pub mod unix;
28+
pub mod linux;
2929
#[cfg(all(
3030
doc,
3131
any(
@@ -36,7 +36,7 @@ pub mod unix;
3636
))]
3737
#[unstable(issue = "none", feature = "std_internals")]
3838
#[path = "fake_unix_windows.rs"]
39-
pub mod linux;
39+
pub mod unix;
4040
#[cfg(all(
4141
doc,
4242
any(
@@ -111,6 +111,8 @@ pub mod windows;
111111
// Others.
112112
#[cfg(target_os = "android")]
113113
pub mod android;
114+
#[cfg(target_os = "custom")]
115+
pub mod custom;
114116
#[cfg(target_os = "dragonfly")]
115117
pub mod dragonfly;
116118
#[cfg(target_os = "emscripten")]

library/std/src/sys/custom/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![allow(missing_docs)]
22

3-
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
4-
use crate::path::{Path, PathBuf};
53
use crate::custom_os_impl;
64
use crate::ffi::OsString;
75
use crate::fmt;
6+
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
7+
use crate::path::{Path, PathBuf};
88

99
use crate::os::custom::time::SystemTime;
1010

library/std/src/sys/custom/locks/condvar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::Mutex;
2-
use crate::sync::atomic::{AtomicU32, Ordering::Relaxed};
32
use super::{futex_wait, futex_wake, futex_wake_all};
3+
use crate::sync::atomic::{AtomicU32, Ordering::Relaxed};
44
use crate::time::Duration;
55

66
pub struct Condvar {

library/std/src/sys/custom/locks/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
/// - futex_wake_all
77
/// - kernel_hold_interrupts
88
/// - kernel_release_interrupts
9-
109
use core::sync::atomic::AtomicU32;
1110
use core::time::Duration;
1211

library/std/src/sys/custom/locks/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use super::{futex_wait, futex_wake};
12
use crate::sync::atomic::{
23
AtomicU32,
34
Ordering::{Acquire, Relaxed, Release},
45
};
5-
use super::{futex_wait, futex_wake};
66

77
pub struct Mutex {
88
/// 0: unlocked

library/std/src/sys/custom/locks/rwlock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use super::{futex_wait, futex_wake, futex_wake_all};
12
use crate::sync::atomic::{
23
AtomicU32,
34
Ordering::{Acquire, Relaxed, Release},
45
};
5-
use super::{futex_wait, futex_wake, futex_wake_all};
66

77
pub struct RwLock {
88
// The state consists of a 30-bit reader counter, a 'readers waiting' flag, and a 'writers waiting' flag.

library/std/src/sys/custom/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! System bindings for custom platforms
22
3-
use crate::io as std_io;
43
use crate::custom_os_impl;
4+
use crate::io as std_io;
55

66
#[path = "../unix/cmath.rs"]
77
pub mod cmath;
@@ -30,12 +30,12 @@ pub mod thread_local_key;
3030
#[deny(unsafe_op_in_unsafe_fn)]
3131
#[allow(unused)]
3232
mod common;
33-
pub use common::{memchr, init, cleanup};
33+
pub use common::{cleanup, init, memchr};
3434

3535
pub mod alloc;
36-
pub mod locks;
3736
pub mod env;
3837
pub mod fs;
38+
pub mod locks;
3939
pub mod net;
4040
pub mod os;
4141
pub mod pipe;
@@ -50,7 +50,9 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
5050
}
5151

5252
pub fn abort_internal() -> ! {
53-
fn infinite_loop() -> ! { loop {} }
53+
fn infinite_loop() -> ! {
54+
loop {}
55+
}
5456

5557
let rwlock = &crate::os::custom::os::IMPL;
5658
let reader = match rwlock.read().ok() {

library/std/src/sys/custom/net.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![allow(missing_docs)]
22

3+
use crate::custom_os_impl;
4+
use crate::fmt;
35
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
46
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
5-
use crate::custom_os_impl;
67
use crate::time::Duration;
7-
use crate::fmt;
88

99
/// Inner content of [`crate::net::TcpStream`]
1010
pub struct TcpStream(pub Box<dyn TcpStreamApi>);
@@ -145,11 +145,7 @@ pub struct LookupHost {
145145

146146
impl LookupHost {
147147
pub fn new(addresses: Vec<SocketAddr>, port: u16) -> Self {
148-
Self {
149-
addresses,
150-
port,
151-
i: 0,
152-
}
148+
Self { addresses, port, i: 0 }
153149
}
154150

155151
pub(crate) fn port(&self) -> u16 {

library/std/src/sys/custom/os.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#![allow(missing_docs)]
22

3-
use crate::str::Split;
4-
use crate::ffi::{OsStr, OsString};
5-
use crate::path::{self, PathBuf};
63
use crate::custom_os_impl;
74
use crate::error::Error;
5+
use crate::ffi::{OsStr, OsString};
86
use crate::fmt;
9-
use crate::vec;
107
use crate::io;
8+
use crate::path::{self, PathBuf};
9+
use crate::str::Split;
10+
use crate::vec;
1111

1212
/// Inner content of [`crate::env::SplitPaths`]
1313
pub struct SplitPaths<'a>(Split<'a, &'static str>);
@@ -109,7 +109,9 @@ impl fmt::Debug for EnvStrDebug<'_> {
109109
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
110110
let Self { slice } = self;
111111
f.debug_list()
112-
.entries(slice.iter().map(|var| (var.name.to_str().unwrap(), var.value.to_str().unwrap())))
112+
.entries(
113+
slice.iter().map(|var| (var.name.to_str().unwrap(), var.value.to_str().unwrap())),
114+
)
113115
.finish()
114116
}
115117
}

0 commit comments

Comments
 (0)