Mercurial > hg
comparison rust/chg/src/procutil.rs @ 45620:426294d06ddc
rust: move rustfmt.toml to repo root so it can be used by `hg fix`
`hg fix` runs the formatters from the repo root so it doesn't pick up
the `rustfmt.toml` configs we had in each the `hg-core`, `hg-cpython`,
and `rhg` packages, which resulted in warnings about `async fn` not
existing in Rust 2015. This patch moves the `rustfmt.toml` file to the
root so `hg fix` will use it.
By putting the `rustfmt.toml` file in a higher-level directory, it
also applies to the `chg` and `hgcli` packages. That makes
`test-check-rust-format.t` fail, so this patch also applies the new
formatting rules to those packages.
Differential Revision: https://phab.mercurial-scm.org/D9142
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 01 Oct 2020 09:09:35 -0700 |
parents | 065048e66f32 |
children |
comparison
equal
deleted
inserted
replaced
45619:e8078af6af30 | 45620:426294d06ddc |
---|---|
42 pub fn set_blocking_fd(fd: RawFd) -> io::Result<()> { | 42 pub fn set_blocking_fd(fd: RawFd) -> io::Result<()> { |
43 let flags = unsafe { libc::fcntl(fd, libc::F_GETFL) }; | 43 let flags = unsafe { libc::fcntl(fd, libc::F_GETFL) }; |
44 if flags < 0 { | 44 if flags < 0 { |
45 return Err(io::Error::last_os_error()); | 45 return Err(io::Error::last_os_error()); |
46 } | 46 } |
47 let r = unsafe { libc::fcntl(fd, libc::F_SETFL, flags & !libc::O_NONBLOCK) }; | 47 let r = |
48 unsafe { libc::fcntl(fd, libc::F_SETFL, flags & !libc::O_NONBLOCK) }; | |
48 if r < 0 { | 49 if r < 0 { |
49 return Err(io::Error::last_os_error()); | 50 return Err(io::Error::last_os_error()); |
50 } | 51 } |
51 Ok(()) | 52 Ok(()) |
52 } | 53 } |
67 /// | 68 /// |
68 /// # Safety | 69 /// # Safety |
69 /// | 70 /// |
70 /// This touches global states, and thus synchronized as a one-time | 71 /// This touches global states, and thus synchronized as a one-time |
71 /// initialization function. | 72 /// initialization function. |
72 pub fn setup_signal_handler_once(pid: u32, pgid: Option<u32>) -> io::Result<()> { | 73 pub fn setup_signal_handler_once( |
74 pid: u32, | |
75 pgid: Option<u32>, | |
76 ) -> io::Result<()> { | |
73 let pid_signed = pid as i32; | 77 let pid_signed = pid as i32; |
74 let pgid_signed = pgid.map(|n| n as i32).unwrap_or(0); | 78 let pgid_signed = pgid.map(|n| n as i32).unwrap_or(0); |
75 let mut r = 0; | 79 let mut r = 0; |
76 SETUP_SIGNAL_HANDLER.call_once(|| { | 80 SETUP_SIGNAL_HANDLER.call_once(|| { |
77 r = unsafe { setupsignalhandler(pid_signed, pgid_signed) }; | 81 r = unsafe { setupsignalhandler(pid_signed, pgid_signed) }; |