mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -96,7 +96,12 @@
|
||||
//! as well. For example if installing the rust nightly from 20.02.2020 using `rustup install nightly-2020-02-20`,
|
||||
//! the wasm target needs to be installed as well `rustup target add wasm32-unknown-unknown --toolchain nightly-2020-02-20`.
|
||||
|
||||
use std::{env, fs, path::{PathBuf, Path}, process::Command, io::BufRead};
|
||||
use std::{
|
||||
env, fs,
|
||||
io::BufRead,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
mod builder;
|
||||
mod prerequisites;
|
||||
@@ -144,18 +149,16 @@ fn copy_file_if_changed(src: PathBuf, dst: PathBuf) {
|
||||
let dst_file = fs::read_to_string(&dst).ok();
|
||||
|
||||
if src_file != dst_file {
|
||||
fs::copy(&src, &dst)
|
||||
.unwrap_or_else(
|
||||
|_| panic!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display())
|
||||
);
|
||||
fs::copy(&src, &dst).unwrap_or_else(|_| {
|
||||
panic!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a cargo command that compiles with nightly
|
||||
fn get_nightly_cargo() -> CargoCommand {
|
||||
let env_cargo = CargoCommand::new(
|
||||
&env::var("CARGO").expect("`CARGO` env variable is always set by cargo"),
|
||||
);
|
||||
let env_cargo =
|
||||
CargoCommand::new(&env::var("CARGO").expect("`CARGO` env variable is always set by cargo"));
|
||||
let default_cargo = CargoCommand::new("cargo");
|
||||
let rustup_run_nightly = CargoCommand::new_with_args("rustup", &["run", "nightly", "cargo"]);
|
||||
let wasm_toolchain = env::var(WASM_BUILD_TOOLCHAIN).ok();
|
||||
@@ -197,7 +200,7 @@ fn get_rustup_nightly(selected: Option<String>) -> Option<CargoCommand> {
|
||||
}
|
||||
|
||||
latest_nightly?.trim_end_matches(&host).into()
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Some(CargoCommand::new_with_args("rustup", &["run", &version, "cargo"]))
|
||||
@@ -253,10 +256,7 @@ struct CargoCommandVersioned {
|
||||
|
||||
impl CargoCommandVersioned {
|
||||
fn new(command: CargoCommand, version: String) -> Self {
|
||||
Self {
|
||||
command,
|
||||
version,
|
||||
}
|
||||
Self { command, version }
|
||||
}
|
||||
|
||||
/// Returns the `rustc` version.
|
||||
|
||||
Reference in New Issue
Block a user