1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 20:47:46 +00:00

expr: Minor linting fix

This commit is contained in:
Joseph Jon Booker 2024-04-03 23:56:23 -05:00
parent bff827d9ed
commit 335b13f940

View file

@ -211,12 +211,12 @@ fn validate_regex(pattern: &str) -> ExprResult<()> {
invalid_content_error = true; invalid_content_error = true;
} }
(Some(x), None) | (Some(x), Some("")) => { (Some(x), None) | (Some(x), Some("")) => {
if !x.parse::<i16>().is_ok() { if x.parse::<i16>().is_err() {
invalid_content_error = true; invalid_content_error = true;
} }
} }
(None, Some(x)) | (Some(""), Some(x)) => { (None, Some(x)) | (Some(""), Some(x)) => {
if !x.parse::<i16>().is_ok() { if x.parse::<i16>().is_err() {
invalid_content_error = true; invalid_content_error = true;
} }
} }
@ -706,13 +706,13 @@ mod test {
#[test] #[test]
fn starting_stars_become_escaped() { fn starting_stars_become_escaped() {
let result = AstNode::parse(&["yolo", ":", r"*yolo"]) let result = AstNode::parse(&["cats", ":", r"*cats"])
.unwrap() .unwrap()
.eval() .eval()
.unwrap(); .unwrap();
assert_eq!(result.eval_as_string(), "0"); assert_eq!(result.eval_as_string(), "0");
let result = AstNode::parse(&["*yolo", ":", r"*yolo"]) let result = AstNode::parse(&["*cats", ":", r"*cats"])
.unwrap() .unwrap()
.eval() .eval()
.unwrap(); .unwrap();
@ -721,7 +721,7 @@ mod test {
#[test] #[test]
fn only_match_in_beginning() { fn only_match_in_beginning() {
let result = AstNode::parse(&["cowsay", ":", r"ow"]) let result = AstNode::parse(&["budget", ":", r"get"])
.unwrap() .unwrap()
.eval() .eval()
.unwrap(); .unwrap();