From 825100c6d65f73e59b64d596a1eeb652d36da49a Mon Sep 17 00:00:00 2001 From: merkrafter Date: Sun, 7 Nov 2021 22:19:08 +0100 Subject: [PATCH] Deny 'block' as unit for --block-size --- src/bin/hexyl.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index 182457a..da4f324 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -148,6 +148,11 @@ fn run() -> Result<(), AnyhowError> { .value_of("block_size") .map(|bs| { let (num, unit) = extract_num_and_unit_from(bs)?; + if let Unit::Block { custom_size: _ } = unit { + return Err(anyhow!( + "can not use 'block(s)' as a unit to specify block size" + )); + }; num.checked_mul(unit.get_multiplier()) .ok_or_else(|| anyhow!(ByteOffsetParseError::UnitMultiplicationOverflow)) .and_then(|x| {