Skip to content

Commit d9cc3c6

Browse files
committed
Made range exclusive, and refactored if statement to use pattern matching
1 parent 0c55044 commit d9cc3c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/default_environment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ pub fn default_env() -> Env {
248248
.ok_or(RuntimeError::new("Failed converting `BigInt` to `usize`"))?
249249
);
250250

251-
while i <= end {
251+
while i < end {
252252
res.push(i.clone());
253253
i += 1;
254254
}
255255

256256
Ok(Value::List(res.into_iter().map(Value::Int).collect::<List>()))
257257
} else {
258-
Ok(Value::List((start..=end).map(Value::Int).collect::<List>()))
258+
Ok(Value::List((start..end).map(Value::Int).collect::<List>()))
259259
}
260260
}
261261
}),

src/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ fn read<'a>(
336336
};
337337
quote_next = false;
338338

339-
if !stack.is_empty() {
340-
if let ParseTree::List { vec, quoted: _ } = stack.last_mut().unwrap() {
339+
if let Some(last) = stack.last_mut() {
340+
if let ParseTree::List { vec, quoted: _ } = last {
341341
vec.push(expr);
342342
}
343343
None

0 commit comments

Comments
 (0)