Mercurial > public > mercurial-scm > hg
diff rust/chg/src/locator.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 | 27fe8cc1338f |
children |
line wrap: on
line diff
--- a/rust/chg/src/locator.rs Wed Sep 30 18:07:21 2020 +0530 +++ b/rust/chg/src/locator.rs Thu Oct 01 09:09:35 2020 -0700 @@ -71,8 +71,12 @@ } /// Specifies the arguments to be passed to the server at start. - pub fn set_early_args(&mut self, args: impl IntoIterator<Item = impl AsRef<OsStr>>) { - self.hg_early_args = args.into_iter().map(|a| a.as_ref().to_owned()).collect(); + pub fn set_early_args( + &mut self, + args: impl IntoIterator<Item = impl AsRef<OsStr>>, + ) { + self.hg_early_args = + args.into_iter().map(|a| a.as_ref().to_owned()).collect(); } /// Connects to the server. @@ -104,7 +108,10 @@ /// Runs instructions received from the server. /// /// Returns true if the client should try connecting to the other server. - fn run_instructions(&mut self, instructions: &[Instruction]) -> io::Result<bool> { + fn run_instructions( + &mut self, + instructions: &[Instruction], + ) -> io::Result<bool> { let mut reconnect = false; for inst in instructions { debug!("instruction: {:?}", inst); @@ -123,7 +130,10 @@ "insecure redirect instruction from server: {}", path.display() ); - return Err(io::Error::new(io::ErrorKind::InvalidData, msg)); + return Err(io::Error::new( + io::ErrorKind::InvalidData, + msg, + )); } self.redirect_sock_path = Some(path.to_owned()); reconnect = true; @@ -134,7 +144,10 @@ "insecure unlink instruction from server: {}", path.display() ); - return Err(io::Error::new(io::ErrorKind::InvalidData, msg)); + return Err(io::Error::new( + io::ErrorKind::InvalidData, + msg, + )); } fs::remove_file(path).unwrap_or(()); // may race } @@ -319,7 +332,10 @@ P: AsRef<Path>, { let a = fs::symlink_metadata(path.as_ref())?; - if a.is_dir() && a.uid() == procutil::get_effective_uid() && (a.mode() & 0o777) == 0o700 { + if a.is_dir() + && a.uid() == procutil::get_effective_uid() + && (a.mode() & 0o777) == 0o700 + { Ok(path) } else { Err(io::Error::new(io::ErrorKind::Other, "insecure directory")) @@ -344,7 +360,9 @@ } /// Collects arguments which need to be passed to the server at start. -pub fn collect_early_args(args: impl IntoIterator<Item = impl AsRef<OsStr>>) -> Vec<OsString> { +pub fn collect_early_args( + args: impl IntoIterator<Item = impl AsRef<OsStr>>, +) -> Vec<OsString> { let mut args_iter = args.into_iter(); let mut early_args = Vec::new(); while let Some(arg) = args_iter.next() {