mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
expr: clean up conversion from bigint to usize
This commit is contained in:
parent
3bf966df56
commit
7f23faf899
1 changed files with 4 additions and 2 deletions
|
@ -294,12 +294,14 @@ impl AstNode {
|
|||
let pos = pos
|
||||
.eval()?
|
||||
.eval_as_bigint()
|
||||
.map_or(0.into(), |n| n.to_usize())
|
||||
.ok()
|
||||
.and_then(|n| n.to_usize())
|
||||
.unwrap_or(0);
|
||||
let length = length
|
||||
.eval()?
|
||||
.eval_as_bigint()
|
||||
.map_or(0.into(), |n| n.to_usize())
|
||||
.ok()
|
||||
.and_then(|n| n.to_usize())
|
||||
.unwrap_or(0);
|
||||
|
||||
let (Some(pos), Some(_)) = (pos.checked_sub(1), length.checked_sub(1)) else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue