Skip to content

Commit cbb156c

Browse files
committed
refactor: rename parameter to clarify cksum vs hashsum terminology
Rename detect_algo_with_label parameter from 'use_length_label' to 'is_cksum' for better self-documentation: - When true: cksum (error messages use '--length') - When false: hashsum tools (error messages use '--bits') This makes the code's intent clear without comments.
1 parent 4e87d5d commit cbb156c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/uucore/src/lib/features/checksum.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn print_file_report<W: Write>(
360360
pub fn detect_algo_with_label(
361361
algo: &str,
362362
length: Option<usize>,
363-
use_length_label: bool,
363+
is_cksum: bool,
364364
) -> UResult<HashAlgorithm> {
365365
match algo {
366366
ALGORITHM_OPTIONS_SYSV => Ok(HashAlgorithm {
@@ -442,7 +442,7 @@ pub fn detect_algo_with_label(
442442
}),
443443
ALGORITHM_OPTIONS_SHAKE128 | "shake128sum" => {
444444
let Some(bits) = length else {
445-
if use_length_label {
445+
if is_cksum {
446446
return Err(USimpleError::new(1, "--length required for SHAKE128"));
447447
}
448448
return Err(ChecksumError::BitsRequiredForShake128.into());
@@ -455,7 +455,7 @@ pub fn detect_algo_with_label(
455455
}
456456
ALGORITHM_OPTIONS_SHAKE256 | "shake256sum" => {
457457
let Some(bits) = length else {
458-
if use_length_label {
458+
if is_cksum {
459459
return Err(USimpleError::new(1, "--length required for SHAKE256"));
460460
}
461461
return Err(ChecksumError::BitsRequiredForShake256.into());
@@ -468,7 +468,7 @@ pub fn detect_algo_with_label(
468468
}
469469
_ if algo.starts_with("sha3") => {
470470
let Some(bits) = length else {
471-
if use_length_label {
471+
if is_cksum {
472472
return Err(USimpleError::new(1, "--length required for SHA3"));
473473
}
474474
return Err(ChecksumError::BitsRequiredForSha3.into());

0 commit comments

Comments
 (0)