Skip to content

Commit 3e67348

Browse files
committed
Proof that rustfmt in CI is broken
1 parent a4789b8 commit 3e67348

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/net/if_.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
//! Uses Linux and/or POSIX functions to resolve interface names like "eth0"
44
//! or "socan1" into device numbers.
55
6-
use std::{ffi::{CStr, CString}, fmt};
76
use crate::{errno::Errno, Error, NixPath, Result};
87
use libc::{c_uint, IF_NAMESIZE};
8+
use std::{
9+
ffi::{CStr, CString},
10+
fmt,
11+
};
912

1013
#[cfg(not(solarish))]
1114
/// type alias for InterfaceFlags
@@ -31,18 +34,19 @@ pub fn if_indextoname(index: c_uint) -> Result<CString> {
3134
// We need to allocate this anyway, so doing it directly is faster.
3235
let mut buf = vec![0u8; IF_NAMESIZE];
3336

34-
let return_buf = unsafe {
35-
libc::if_indextoname(index, buf.as_mut_ptr().cast())
36-
};
37+
let return_buf =
38+
unsafe { libc::if_indextoname(index, buf.as_mut_ptr().cast()) };
3739

3840
Errno::result(return_buf.cast())?;
39-
Ok(CStr::from_bytes_until_nul(buf.as_slice()).unwrap().to_owned())
41+
Ok(CStr::from_bytes_until_nul(buf.as_slice())
42+
.unwrap()
43+
.to_owned())
4044
}
4145

4246
libc_bitflags!(
4347
/// Standard interface flags, used by `getifaddrs`
4448
pub struct InterfaceFlags: IflagsType {
45-
49+
4650
/// Interface is running. (see
4751
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
4852
IFF_UP as IflagsType;
@@ -264,13 +268,7 @@ impl fmt::Display for InterfaceFlags {
264268
}
265269
}
266270

267-
268-
#[cfg(any(
269-
bsd,
270-
target_os = "fuchsia",
271-
target_os = "linux",
272-
solarish,
273-
))]
271+
#[cfg(any(bsd, target_os = "fuchsia", target_os = "linux", solarish,))]
274272
mod if_nameindex {
275273
use super::*;
276274

@@ -392,10 +390,5 @@ mod if_nameindex {
392390
}
393391
}
394392
}
395-
#[cfg(any(
396-
bsd,
397-
target_os = "fuchsia",
398-
target_os = "linux",
399-
solarish,
400-
))]
393+
#[cfg(any(bsd, target_os = "fuchsia", target_os = "linux", solarish,))]
401394
pub use if_nameindex::*;

0 commit comments

Comments
 (0)