Skip to content

Commit 0ba6470

Browse files
committed
minor optimization
1 parent 1773d2b commit 0ba6470

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

pdc.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
RUSTPYTHONPATH=Lib
2+
export RUSTPYTHONPATH
3+
4+
ACTIONS=("cargo build" "cargo build --release" "cargo fmt --all" "cargo clippy --all -- -Dwarnings" "cargo test --all" "cargo run --release -- -m test -v" "cd tests" "pytest" "cd ..")
5+
ACT_RES=0
6+
FAILS=()
7+
8+
for act in "${ACTIONS[@]}"; do
9+
$act
10+
if ! [ $? -eq 0 ]; then
11+
ACT_RES=1
12+
FAILS+=("${act}")
13+
fi
14+
done
15+
16+
echo
17+
echo
18+
echo "*********************"
19+
if ! [ $ACT_RES -eq 0 ]; then
20+
echo "PDC failed"
21+
for el in "${FAILS[@]}"; do
22+
echo " Fail ${el}"
23+
done
24+
echo
25+
else
26+
echo "PDC passed"
27+
fi

vm/src/scope.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,7 @@ impl NameProtocol for Scope {
114114

115115
fn store_cell(&self, vm: &VirtualMachine, name: &str, value: PyObjectRef) {
116116
// find the innermost outer scope that contains the symbol name
117-
if let Some(locals) = self
118-
.locals
119-
.iter()
120-
.rev()
121-
.filter(|l| l.contains_key(name, vm))
122-
.nth(0)
123-
{
117+
if let Some(locals) = self.locals.iter().rev().find(|l| l.contains_key(name, vm)) {
124118
// add to the symbol
125119
locals.set_item(name, value, vm).unwrap();
126120
} else {

0 commit comments

Comments
 (0)