style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -303,8 +303,8 @@ impl CargoCommand {
|
||||
|
||||
/// Returns whether this version of the toolchain supports nightly features.
|
||||
fn supports_nightly_features(&self) -> bool {
|
||||
self.version.map_or(false, |version| version.is_nightly) ||
|
||||
env::var("RUSTC_BOOTSTRAP").is_ok()
|
||||
self.version.map_or(false, |version| version.is_nightly)
|
||||
|| env::var("RUSTC_BOOTSTRAP").is_ok()
|
||||
}
|
||||
|
||||
/// Check if the supplied cargo command supports our runtime environment.
|
||||
@@ -433,12 +433,13 @@ impl RuntimeTarget {
|
||||
/// Figures out the target parameter value for rustc.
|
||||
fn rustc_target(self, cargo_command: &CargoCommand) -> String {
|
||||
match self {
|
||||
RuntimeTarget::Wasm =>
|
||||
RuntimeTarget::Wasm => {
|
||||
if cargo_command.is_wasm32v1_none_target_available() {
|
||||
"wasm32v1-none".into()
|
||||
} else {
|
||||
"wasm32-unknown-unknown".into()
|
||||
},
|
||||
}
|
||||
},
|
||||
RuntimeTarget::Riscv => {
|
||||
let path = polkavm_linker::target_json_32_path().expect("riscv not found");
|
||||
path.into_os_string().into_string().unwrap()
|
||||
@@ -449,12 +450,13 @@ impl RuntimeTarget {
|
||||
/// Figures out the target directory name used by cargo.
|
||||
fn rustc_target_dir(self, cargo_command: &CargoCommand) -> &'static str {
|
||||
match self {
|
||||
RuntimeTarget::Wasm =>
|
||||
RuntimeTarget::Wasm => {
|
||||
if cargo_command.is_wasm32v1_none_target_available() {
|
||||
"wasm32v1-none".into()
|
||||
} else {
|
||||
"wasm32-unknown-unknown".into()
|
||||
},
|
||||
}
|
||||
},
|
||||
RuntimeTarget::Riscv => "riscv32emac-unknown-none-polkavm",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,8 +267,8 @@ fn check_wasm_toolchain_installed(
|
||||
}
|
||||
}
|
||||
|
||||
if cargo_command.supports_wasm32v1_none_target() &&
|
||||
!cargo_command.is_wasm32v1_none_target_installed()
|
||||
if cargo_command.supports_wasm32v1_none_target()
|
||||
&& !cargo_command.is_wasm32v1_none_target_installed()
|
||||
{
|
||||
build_helper::warning!("You are building WASM runtime using `wasm32-unknown-unknown` target, although Rust >= 1.84 supports `wasm32v1-none` target!");
|
||||
build_helper::warning!("You can install it with `rustup target add wasm32v1-none --toolchain {toolchain}` if you're using `rustup`.");
|
||||
|
||||
@@ -421,10 +421,11 @@ fn get_wasm_workspace_root() -> PathBuf {
|
||||
loop {
|
||||
match out_dir.parent() {
|
||||
Some(parent) if out_dir.ends_with("build") => return parent.to_path_buf(),
|
||||
_ =>
|
||||
_ => {
|
||||
if !out_dir.pop() {
|
||||
break;
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,18 +614,18 @@ fn project_enabled_features(
|
||||
// this heuristic anymore. However, for the transition phase between now and namespaced
|
||||
// features already being present in nightly, we need this code to make
|
||||
// runtimes compile with all the possible rustc versions.
|
||||
if v.len() == 1 &&
|
||||
v.get(0).map_or(false, |v| *v == format!("dep:{}", f)) &&
|
||||
std_enabled.as_ref().map(|e| e.iter().any(|ef| ef == *f)).unwrap_or(false)
|
||||
if v.len() == 1
|
||||
&& v.get(0).map_or(false, |v| *v == format!("dep:{}", f))
|
||||
&& std_enabled.as_ref().map(|e| e.iter().any(|ef| ef == *f)).unwrap_or(false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// We don't want to enable the `std`/`default` feature for the wasm build and
|
||||
// we need to check if the feature is enabled by checking the env variable.
|
||||
*f != "std" &&
|
||||
*f != "default" &&
|
||||
env::var(format!("CARGO_FEATURE_{feature_env}"))
|
||||
*f != "std"
|
||||
&& *f != "default"
|
||||
&& env::var(format!("CARGO_FEATURE_{feature_env}"))
|
||||
.map(|v| v == "1")
|
||||
.unwrap_or_default()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user