comparison rust/hgcli/src/main.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 26ce8e751503
children
comparison
equal deleted inserted replaced
45619:e8078af6af30 45620:426294d06ddc
7 // remove this line and instantiate your own instance of 7 // remove this line and instantiate your own instance of
8 // `pyembed::PythonConfig`. 8 // `pyembed::PythonConfig`.
9 include!(env!("PYOXIDIZER_DEFAULT_PYTHON_CONFIG_RS")); 9 include!(env!("PYOXIDIZER_DEFAULT_PYTHON_CONFIG_RS"));
10 10
11 fn main() { 11 fn main() {
12 // The following code is in a block so the MainPythonInterpreter is destroyed in an 12 // The following code is in a block so the MainPythonInterpreter is
13 // orderly manner, before process exit. 13 // destroyed in an orderly manner, before process exit.
14 let code = { 14 let code = {
15 // Load the default Python configuration as derived by the PyOxidizer config 15 // Load the default Python configuration as derived by the PyOxidizer
16 // file used at build time. 16 // config file used at build time.
17 let config = default_python_config(); 17 let config = default_python_config();
18 18
19 // Construct a new Python interpreter using that config, handling any errors 19 // Construct a new Python interpreter using that config, handling any
20 // from construction. 20 // errors from construction.
21 match MainPythonInterpreter::new(config) { 21 match MainPythonInterpreter::new(config) {
22 Ok(mut interp) => { 22 Ok(mut interp) => {
23 // And run it using the default run configuration as specified by the 23 // And run it using the default run configuration as specified
24 // configuration. If an uncaught Python exception is raised, handle it. 24 // by the configuration. If an uncaught Python
25 // This includes the special SystemExit, which is a request to terminate the 25 // exception is raised, handle it.
26 // process. 26 // This includes the special SystemExit, which is a request to
27 // terminate the process.
27 interp.run_as_main() 28 interp.run_as_main()
28 } 29 }
29 Err(msg) => { 30 Err(msg) => {
30 eprintln!("{}", msg); 31 eprintln!("{}", msg);
31 1 32 1