Skip to content

Commit 516ff0f

Browse files
Auto-format: cargo fmt --all
1 parent 958853f commit 516ff0f

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

crates/vm/src/frame.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ use crate::{
2626
};
2727
use alloc::fmt;
2828
use bstr::ByteSlice;
29+
use core::cell::UnsafeCell;
2930
use core::iter::zip;
3031
use core::sync::atomic;
3132
use core::sync::atomic::AtomicPtr;
3233
use core::sync::atomic::Ordering::Relaxed;
3334
use indexmap::IndexMap;
3435
use itertools::Itertools;
35-
use core::cell::UnsafeCell;
3636
use rustpython_common::atomic::{PyAtomic, Radium};
3737
use rustpython_common::{
3838
boxvec::BoxVec,
@@ -1822,16 +1822,18 @@ impl ExecutingFrame<'_> {
18221822
// Same as LoadFast but explicitly checks for unbound locals
18231823
// (LoadFast in RustPython already does this check)
18241824
let idx = idx.get(arg) as usize;
1825-
let x = unsafe { self.fastlocals.borrow() }[idx].clone().ok_or_else(|| {
1826-
vm.new_exception_msg(
1827-
vm.ctx.exceptions.unbound_local_error.to_owned(),
1828-
format!(
1829-
"local variable '{}' referenced before assignment",
1830-
self.code.varnames[idx]
1825+
let x = unsafe { self.fastlocals.borrow() }[idx]
1826+
.clone()
1827+
.ok_or_else(|| {
1828+
vm.new_exception_msg(
1829+
vm.ctx.exceptions.unbound_local_error.to_owned(),
1830+
format!(
1831+
"local variable '{}' referenced before assignment",
1832+
self.code.varnames[idx]
1833+
)
1834+
.into(),
18311835
)
1832-
.into(),
1833-
)
1834-
})?;
1836+
})?;
18351837
self.push_value(x);
18361838
Ok(None)
18371839
}
@@ -1870,16 +1872,18 @@ impl ExecutingFrame<'_> {
18701872
// Currently this just clones like LoadFast.
18711873
Instruction::LoadFastBorrow(idx) => {
18721874
let idx = idx.get(arg) as usize;
1873-
let x = unsafe { self.fastlocals.borrow() }[idx].clone().ok_or_else(|| {
1874-
vm.new_exception_msg(
1875-
vm.ctx.exceptions.unbound_local_error.to_owned(),
1876-
format!(
1877-
"local variable '{}' referenced before assignment",
1878-
self.code.varnames[idx]
1875+
let x = unsafe { self.fastlocals.borrow() }[idx]
1876+
.clone()
1877+
.ok_or_else(|| {
1878+
vm.new_exception_msg(
1879+
vm.ctx.exceptions.unbound_local_error.to_owned(),
1880+
format!(
1881+
"local variable '{}' referenced before assignment",
1882+
self.code.varnames[idx]
1883+
)
1884+
.into(),
18791885
)
1880-
.into(),
1881-
)
1882-
})?;
1886+
})?;
18831887
self.push_value(x);
18841888
Ok(None)
18851889
}

0 commit comments

Comments
 (0)