Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit d58f645

Browse files
committed
rustfmt
1 parent b5af290 commit d58f645

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

liblumen_eir_interpreter/src/exec/match.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
use std::convert::TryInto;
22
use std::sync::Arc;
33

4-
use libeir_ir::{ Block, MatchKind, PrimOpKind, BasicType,
5-
BinaryEntrySpecifier, Endianness };
4+
use libeir_ir::{BasicType, BinaryEntrySpecifier, Block, Endianness, MatchKind, PrimOpKind};
65

7-
use lumen_runtime::otp::erlang;
8-
use liblumen_alloc::erts::term::{ Term, TypedTerm, Tuple, Atom, Integer, Closure,
9-
AsTerm, atom_unchecked };
10-
use liblumen_alloc::erts::process::ProcessControlBlock;
116
use liblumen_alloc::erts::exception::system;
7+
use liblumen_alloc::erts::process::ProcessControlBlock;
8+
use liblumen_alloc::erts::term::{
9+
atom_unchecked, AsTerm, Atom, Closure, Integer, Term, Tuple, TypedTerm,
10+
};
11+
use lumen_runtime::otp::erlang;
1212

13+
use super::{CallExecutor, OpResult};
1314
use crate::module::ErlangFunction;
14-
use super::{ CallExecutor, OpResult };
1515

1616
pub fn match_op(
1717
exec: &mut CallExecutor,
1818
proc: &Arc<ProcessControlBlock>,
1919
fun: &ErlangFunction,
2020
branches: &[MatchKind],
21-
block: Block
22-
) -> std::result::Result<OpResult, system::Exception>
23-
{
21+
block: Block,
22+
) -> std::result::Result<OpResult, system::Exception> {
2423
let reads = fun.fun.block_reads(block);
2524

2625
let branches_prim = fun.fun.value_primop(reads[0]).unwrap();
@@ -29,9 +28,7 @@ pub fn match_op(
2928

3029
let unpack_term = exec.make_term(proc, fun, reads[1]).unwrap();
3130

32-
for (idx, (kind, branch)) in branches.iter()
33-
.zip(branches_dests.iter()).enumerate()
34-
{
31+
for (idx, (kind, branch)) in branches.iter().zip(branches_dests.iter()).enumerate() {
3532
let branch_arg_prim = fun.fun.value_primop(reads[idx + 2]).unwrap();
3633
assert!(fun.fun.primop_kind(branch_arg_prim) == &PrimOpKind::ValueList);
3734
let branch_args = fun.fun.primop_reads(branch_arg_prim);

liblumen_eir_interpreter/src/exec/mod.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@ use std::convert::TryInto;
33
use std::rc::Rc;
44
use std::sync::Arc;
55

6-
use libeir_ir::{ Block, Value, OpKind, ValueKind, PrimOpKind };
7-
use libeir_ir::constant::{ Const, ConstKind, AtomicTerm };
8-
use libeir_intern::{ Symbol };
96
use cranelift_entity::EntityRef;
7+
use libeir_intern::Symbol;
8+
use libeir_ir::constant::{AtomicTerm, Const, ConstKind};
9+
use libeir_ir::{Block, OpKind, PrimOpKind, Value, ValueKind};
1010

11-
use liblumen_alloc::erts::ModuleFunctionArity;
12-
use liblumen_alloc::erts::term::{ Term, TypedTerm, Atom,
13-
AsTerm, atom_unchecked };
14-
use liblumen_alloc::erts::process::ProcessControlBlock;
15-
use liblumen_alloc::erts::process::code::Result;
1611
use liblumen_alloc::erts::exception::system;
12+
use liblumen_alloc::erts::process::code::Result;
13+
use liblumen_alloc::erts::process::ProcessControlBlock;
14+
use liblumen_alloc::erts::term::{atom_unchecked, AsTerm, Atom, Term, TypedTerm};
15+
use liblumen_alloc::erts::ModuleFunctionArity;
1716

18-
use crate::module::{ ErlangFunction, ResolvedFunction };
17+
use crate::module::{ErlangFunction, ResolvedFunction};
1918
use crate::vm::VMState;
2019

2120
mod r#match;
@@ -232,9 +231,7 @@ impl CallExecutor {
232231
//ConstKind::Atomic(AtomicTerm::Binary(bin)) => {
233232
// Term::Binary(Rc::new(bin.0.clone().into())).into()
234233
//}
235-
ConstKind::Atomic(AtomicTerm::Nil) => {
236-
Ok(Term::NIL)
237-
}
234+
ConstKind::Atomic(AtomicTerm::Nil) => Ok(Term::NIL),
238235
//ConstKind::ListCell { head, tail } => {
239236
// Term::ListCell(
240237
// self.make_const_term(fun, *head),
@@ -462,9 +459,7 @@ impl CallExecutor {
462459
// args: vec![Term::Nil.into()],
463460
// }
464461
//}
465-
OpKind::Match { branches } => {
466-
self::r#match::match_op(self, proc, fun, branches, block)
467-
}
462+
OpKind::Match { branches } => self::r#match::match_op(self, proc, fun, branches, block),
468463
//OpKind::BinaryPush { specifier } => {
469464
// let bin_term = self.make_term(fun, reads[2]);
470465
// let mut bin = match &*bin_term {

liblumen_eir_interpreter/src/native/erlang.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ pub fn make_erlang() -> NativeModule {
2121
Ok(erlang::add_2(args[0], args[1], proc).unwrap())
2222
});
2323

24-
native.add_fun(Atom::try_from_str("monotonic_time").unwrap(), 0, |proc, args| {
25-
assert!(args.len() == 0);
26-
Ok(erlang::monotonic_time_0(proc).unwrap())
27-
});
24+
native.add_fun(
25+
Atom::try_from_str("monotonic_time").unwrap(),
26+
0,
27+
|proc, args| {
28+
assert!(args.len() == 0);
29+
Ok(erlang::monotonic_time_0(proc).unwrap())
30+
},
31+
);
2832

2933
native
3034
}

0 commit comments

Comments
 (0)