Skip to content

Commit 859b6f7

Browse files
Auto-format: cargo fmt --all
1 parent 3c00316 commit 859b6f7

File tree

1 file changed

+42
-26
lines changed

1 file changed

+42
-26
lines changed

crates/vm/src/frame.rs

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,18 +2440,16 @@ impl ExecutingFrame<'_> {
24402440
// Same as LoadFast but explicitly checks for unbound locals
24412441
// (LoadFast in RustPython already does this check)
24422442
let idx = var_num.get(arg) as usize;
2443-
let x = self.localsplus.fastlocals()[idx]
2444-
.clone()
2445-
.ok_or_else(|| {
2446-
vm.new_exception_msg(
2447-
vm.ctx.exceptions.unbound_local_error.to_owned(),
2448-
format!(
2449-
"local variable '{}' referenced before assignment",
2450-
self.code.varnames[idx]
2451-
)
2452-
.into(),
2443+
let x = self.localsplus.fastlocals()[idx].clone().ok_or_else(|| {
2444+
vm.new_exception_msg(
2445+
vm.ctx.exceptions.unbound_local_error.to_owned(),
2446+
format!(
2447+
"local variable '{}' referenced before assignment",
2448+
self.code.varnames[idx]
24532449
)
2454-
})?;
2450+
.into(),
2451+
)
2452+
})?;
24552453
self.push_value(x);
24562454
Ok(None)
24572455
}
@@ -2491,18 +2489,16 @@ impl ExecutingFrame<'_> {
24912489
// lifetime issues at yield/exception points are resolved.
24922490
Instruction::LoadFastBorrow { var_num } => {
24932491
let idx = var_num.get(arg) as usize;
2494-
let x = self.localsplus.fastlocals()[idx]
2495-
.clone()
2496-
.ok_or_else(|| {
2497-
vm.new_exception_msg(
2498-
vm.ctx.exceptions.unbound_local_error.to_owned(),
2499-
format!(
2500-
"local variable '{}' referenced before assignment",
2501-
self.code.varnames[idx]
2502-
)
2503-
.into(),
2492+
let x = self.localsplus.fastlocals()[idx].clone().ok_or_else(|| {
2493+
vm.new_exception_msg(
2494+
vm.ctx.exceptions.unbound_local_error.to_owned(),
2495+
format!(
2496+
"local variable '{}' referenced before assignment",
2497+
self.code.varnames[idx]
25042498
)
2505-
})?;
2499+
.into(),
2500+
)
2501+
})?;
25062502
self.push_value(x);
25072503
Ok(None)
25082504
}
@@ -6136,11 +6132,21 @@ impl ExecutingFrame<'_> {
61366132
args_vec.push(self_val);
61376133
}
61386134
for stack_idx in args_start..stack_len {
6139-
let val = self.localsplus.stack_index_mut(stack_idx).take().unwrap().to_pyobj();
6135+
let val = self
6136+
.localsplus
6137+
.stack_index_mut(stack_idx)
6138+
.take()
6139+
.unwrap()
6140+
.to_pyobj();
61406141
args_vec.push(val);
61416142
}
61426143

6143-
let callable_obj = self.localsplus.stack_index_mut(callable_idx).take().unwrap().to_pyobj();
6144+
let callable_obj = self
6145+
.localsplus
6146+
.stack_index_mut(callable_idx)
6147+
.take()
6148+
.unwrap()
6149+
.to_pyobj();
61446150
self.localsplus.stack_truncate(callable_idx);
61456151

61466152
let result = callable_obj.vectorcall(args_vec, effective_nargs, None, vm)?;
@@ -6216,11 +6222,21 @@ impl ExecutingFrame<'_> {
62166222
args_vec.push(self_val);
62176223
}
62186224
for stack_idx in args_start..stack_len {
6219-
let val = self.localsplus.stack_index_mut(stack_idx).take().unwrap().to_pyobj();
6225+
let val = self
6226+
.localsplus
6227+
.stack_index_mut(stack_idx)
6228+
.take()
6229+
.unwrap()
6230+
.to_pyobj();
62206231
args_vec.push(val);
62216232
}
62226233

6223-
let callable_obj = self.localsplus.stack_index_mut(callable_idx).take().unwrap().to_pyobj();
6234+
let callable_obj = self
6235+
.localsplus
6236+
.stack_index_mut(callable_idx)
6237+
.take()
6238+
.unwrap()
6239+
.to_pyobj();
62246240
self.localsplus.stack_truncate(callable_idx);
62256241

62266242
let kwnames = kwarg_names_tuple.as_slice();

0 commit comments

Comments
 (0)