diff --git a/calc/bc_util/parser.rs b/calc/bc_util/parser.rs index 2764e970..ae123a2b 100644 --- a/calc/bc_util/parser.rs +++ b/calc/bc_util/parser.rs @@ -263,7 +263,7 @@ fn parse_stmt( in_loop: bool, statements: &mut Vec, source_locations: &mut Vec, -) -> Result { +) -> Result> { let stmt = first_child(stmt); let (line, _) = stmt.line_col(); source_locations.push(line); @@ -271,12 +271,12 @@ fn parse_stmt( match stmt.as_rule() { Rule::break_stmt => { if !in_loop { - return Err(pest::error::Error::new_from_span( + return Err(Box::new(pest::error::Error::new_from_span( pest::error::ErrorVariant::CustomError { message: "break outside of loop".to_string(), }, stmt.as_span(), - )); + ))); } statements.push(StmtInstruction::Break); } @@ -286,12 +286,12 @@ fn parse_stmt( Rule::return_stmt => { // return ( "(" expr? ")" )? if !in_function { - return Err(pest::error::Error::new_from_span( + return Err(Box::new(pest::error::Error::new_from_span( pest::error::ErrorVariant::CustomError { message: "return outside of function".to_string(), }, stmt.as_span(), - )); + ))); } let mut inner = stmt.into_inner(); if let Some(expr) = inner.next() { @@ -381,7 +381,7 @@ fn parse_stmt( Ok(instruction_count) } -fn parse_function(func: Pair, file: Rc) -> Result { +fn parse_function(func: Pair, file: Rc) -> Result> { let mut function = func.into_inner(); // define letter ( parameter_list ) auto_define_list statement_list end @@ -586,7 +586,7 @@ pub fn parse_program(text: &str, file_path: Option<&str>) -> Result) -> Result errors.push(e), + Err(e) => errors.push(*e), }, Rule::EOI => {} _ => unreachable!(), diff --git a/screen/stty.rs b/screen/stty.rs index 19547587..b97651d7 100644 --- a/screen/stty.rs +++ b/screen/stty.rs @@ -190,6 +190,7 @@ fn stty_show_long(ti: Termios) -> io::Result<()> { } // display compact, parse-able form stty values +#[allow(clippy::unnecessary_cast)] // tcflag_t is u64 on macOS, u32 on Linux fn stty_show_compact(ti: Termios) -> io::Result<()> { // encode settings as pairs of (String,u64) let mut tiv = vec![