Skip to content

Commit 9e9ed7c

Browse files
committed
misc refactor
1 parent fd5ace9 commit 9e9ed7c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

extensions/scarb-execute/src/hint_processor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use std::rc::Rc;
1919
pub struct ExecuteHintProcessor<'a> {
2020
pub cairo_hint_processor: CairoHintProcessor<'a>,
2121
pub oracle_hint_service: OracleHintService,
22-
/// Captured felts from `println!` / `print!` statements
23-
/// Only used if `capture_enabled` is true
22+
/// Captured felts from `printl!` and `println!` statements.
23+
/// Only populated if `capture_enabled` is `true`.
2424
pub captured_print_felts: Vec<Vec<Felt252>>,
2525
pub capture_enabled: bool,
2626
}

extensions/scarb-execute/src/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ pub fn execute(
163163
let mut hint_processor = ExecuteHintProcessor {
164164
cairo_hint_processor,
165165
oracle_hint_service: OracleHintService::new(Some(executable_path.as_std_path())),
166-
captured_print_felts: Vec::new(),
167166
capture_enabled: args.run.save_print_output,
167+
captured_print_felts: Default::default(),
168168
};
169169

170170
let proof_mode = args.run.target.is_standalone();
@@ -197,16 +197,12 @@ pub fn execute(
197197
.then(|| ExecutionResources::try_new(&runner, hint_processor.cairo_hint_processor).ok())
198198
.flatten();
199199

200-
let captured_print_output = if !hint_processor.captured_print_felts.is_empty() {
201-
hint_processor
202-
.captured_print_felts
203-
.into_iter()
204-
.map(|felts| format_for_debug(felts.into_iter()).to_string())
205-
.collect::<Vec<_>>()
206-
.join("")
207-
} else {
208-
String::new()
209-
};
200+
let captured_print_output = hint_processor
201+
.captured_print_felts
202+
.into_iter()
203+
.map(|felts| format_for_debug(felts.into_iter()).to_string())
204+
.collect::<Vec<_>>()
205+
.join("");
210206

211207
let execution_output = (args.run.print_program_output || args.run.save_program_output)
212208
.then(|| ExecutionOutput::try_new(&mut runner))

0 commit comments

Comments
 (0)