From 5609476ed97fec92eb112279f93cef0f33022186 Mon Sep 17 00:00:00 2001 From: Michael Benfield Date: Wed, 4 Dec 2024 17:04:45 -0800 Subject: [PATCH] cleanup --- interpreter/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/interpreter/src/lib.rs b/interpreter/src/lib.rs index 4486686430..3eaa7470cc 100644 --- a/interpreter/src/lib.rs +++ b/interpreter/src/lib.rs @@ -96,11 +96,8 @@ Input history is available - use the up and down arrow keys. fn parse_breakpoint(s: &str) -> Option { let strings: Vec<&str> = s.split_whitespace().collect(); if strings.len() == 2 { - let mut program = strings[0].to_string(); - if program.ends_with(".aleo") { - program.truncate(program.len() - 5); - } if let Ok(line) = strings[1].parse::() { + let program = strings[0].strip_suffix(".aleo").unwrap_or(strings[0]).to_string(); return Some(Breakpoint { program, line }); } } @@ -133,11 +130,7 @@ pub fn interpret( interpreter.update_watchpoints()?; for (i, watchpoint) in interpreter.watchpoints.iter().enumerate() { - println!( - "{i:>4}: {:>20} = {}", - watchpoint.code, - watchpoint.last_result.as_ref().map(|s| s.as_str()).unwrap_or("") - ); + println!("{i:>4}: {:>20} = {}", watchpoint.code, watchpoint.last_result.as_deref().unwrap_or("")); } let user_input: String = dialoguer::Input::with_theme(&dialoguer::theme::ColorfulTheme::default())