Format libstd/sys with rustfmt

This commit applies rustfmt with rust-lang/rust's default settings to
files in src/libstd/sys *that are not involved in any currently open PR*
to minimize merge conflicts. THe list of files involved in open PRs was
determined by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in outstanding_files, the
relevant commands were:

    $ find src/libstd/sys -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg libstd/sys outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of the files.

To confirm no funny business:

    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
This commit is contained in:
David Tolnay
2019-11-27 10:28:39 -08:00
parent 9081929d45
commit c34fbfaad3
144 changed files with 2527 additions and 2285 deletions

View File

@@ -1,12 +1,12 @@
#![cfg_attr(test, allow(dead_code))]
use self::imp::{make_handler, drop_handler};
use self::imp::{drop_handler, make_handler};
pub use self::imp::cleanup;
pub use self::imp::init;
pub struct Handler {
_data: *mut libc::c_void
_data: *mut libc::c_void,
}
impl Handler {
@@ -23,28 +23,28 @@ impl Drop for Handler {
}
}
#[cfg(any(target_os = "linux",
target_os = "macos",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "solaris",
all(target_os = "netbsd", not(target_vendor = "rumprun")),
target_os = "openbsd"))]
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "solaris",
all(target_os = "netbsd", not(target_vendor = "rumprun")),
target_os = "openbsd"
))]
mod imp {
use super::Handler;
use crate::mem;
use crate::ptr;
use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE};
use libc::{sigaction, SIGBUS, SIG_DFL,
SA_SIGINFO, SA_ONSTACK, sighandler_t};
use libc::{mmap, munmap};
use libc::{SIGSEGV, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON};
use libc::MAP_FAILED;
use libc::{mmap, munmap};
use libc::{sigaction, sighandler_t, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIG_DFL};
use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE};
use libc::{MAP_ANON, MAP_PRIVATE, PROT_READ, PROT_WRITE, SIGSEGV};
use crate::sys_common::thread_info;
#[cfg(any(target_os = "linux", target_os = "android"))]
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
#[repr(C)]
@@ -82,9 +82,11 @@ mod imp {
// out many large systems and all implementations allow returning from a
// signal handler to work. For a more detailed explanation see the
// comments on #26458.
unsafe extern fn signal_handler(signum: libc::c_int,
info: *mut libc::siginfo_t,
_data: *mut libc::c_void) {
unsafe extern "C" fn signal_handler(
signum: libc::c_int,
info: *mut libc::siginfo_t,
_data: *mut libc::c_void,
) {
use crate::sys_common::util::report_overflow;
let guard = thread_info::stack_guard().unwrap_or(0..0);
@@ -124,24 +126,22 @@ mod imp {
}
unsafe fn get_stackp() -> *mut libc::c_void {
let stackp = mmap(ptr::null_mut(),
SIGSTKSZ,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON,
-1,
0);
let stackp =
mmap(ptr::null_mut(), SIGSTKSZ, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if stackp == MAP_FAILED {
panic!("failed to allocate an alternative stack");
}
stackp
}
#[cfg(any(target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris"))]
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris"
))]
unsafe fn get_stack() -> libc::stack_t {
libc::stack_t { ss_sp: get_stackp(), ss_flags: 0, ss_size: SIGSTKSZ }
}
@@ -166,7 +166,7 @@ mod imp {
pub unsafe fn drop_handler(handler: &mut Handler) {
if !handler._data.is_null() {
let stack = libc::stack_t {
let stack = libc::stack_t {
ss_sp: ptr::null_mut(),
ss_flags: SS_DISABLE,
// Workaround for bug in macOS implementation of sigaltstack
@@ -181,26 +181,25 @@ mod imp {
}
}
#[cfg(not(any(target_os = "linux",
target_os = "macos",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "solaris",
all(target_os = "netbsd", not(target_vendor = "rumprun")),
target_os = "openbsd")))]
#[cfg(not(any(
target_os = "linux",
target_os = "macos",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "solaris",
all(target_os = "netbsd", not(target_vendor = "rumprun")),
target_os = "openbsd"
)))]
mod imp {
use crate::ptr;
pub unsafe fn init() {
}
pub unsafe fn init() {}
pub unsafe fn cleanup() {
}
pub unsafe fn cleanup() {}
pub unsafe fn make_handler() -> super::Handler {
super::Handler { _data: ptr::null_mut() }
}
pub unsafe fn drop_handler(_handler: &mut super::Handler) {
}
pub unsafe fn drop_handler(_handler: &mut super::Handler) {}
}