fix(cli): trait-qualify Sha256::digest so it builds with or without the import

Follow-up to the v0.4.2-beta.3 CI break. Importing sha2::Digest fixed the
build there but the import reads as unused locally (different dependency
resolution), leaving a permanent warning in every build. Calling through
<sha2::Sha256 as sha2::Digest>::digest resolves the trait method
explicitly, so it compiles in both environments with no import and no
warning. Workspace now builds clean.
This commit is contained in:
ospab 2026-07-30 14:41:16 +03:00
parent 88e0634f09
commit 0c69617725
1 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,6 @@ use clap::Parser;
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use colored::Colorize; use colored::Colorize;
use sha2::Digest;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(author, version, about = "OSTP Core - Ospab Stealth Transport Protocol", long_about = None)] #[command(author, version, about = "OSTP Core - Ospab Stealth Transport Protocol", long_about = None)]
@ -725,7 +724,14 @@ fn run_setup_wizard(config_path: &std::path::Path) -> Result<()> {
// this used to be a DefaultHasher (SipHash) placeholder that produced a // this used to be a DefaultHasher (SipHash) placeholder that produced a
// differently-shaped digest, so a password set up through this wizard could // differently-shaped digest, so a password set up through this wizard could
// never actually log into the panel it just configured. // never actually log into the panel it just configured.
let pass_hash = format!("{:x}", sha2::Sha256::digest(password.as_bytes())); // Trait-qualified so this compiles whether or not `sha2::Digest` happens
// to be in scope: `digest` is a trait method, and relying on the import
// alone broke the CI build once (v0.4.2-beta.3) while resolving fine
// locally.
let pass_hash = format!(
"{:x}",
<sha2::Sha256 as sha2::Digest>::digest(password.as_bytes())
);
wizard_step(4, TOTAL, "Saving configuration"); wizard_step(4, TOTAL, "Saving configuration");
let panel_bind = format!("0.0.0.0:{}", panel_port); let panel_bind = format!("0.0.0.0:{}", panel_port);