Skip to content

Commit 0468f0e

Browse files
committed
rustfmt autofix
1 parent 69ccae3 commit 0468f0e

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

jit/src/instructions.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
use super::{JitCompileError, JitSig, JitType};
2+
use cranelift::codegen::ir::FuncRef;
13
use cranelift::prelude::*;
24
use num_traits::cast::ToPrimitive;
35
use rustpython_compiler_core::bytecode::{
46
self, BinaryOperator, BorrowedConstant, CodeObject, ComparisonOperator, Instruction, Label,
57
OpArg, OpArgState, UnaryOperator,
68
};
79
use std::collections::HashMap;
8-
use cranelift::codegen::ir::FuncRef;
9-
use super::{JitCompileError, JitSig, JitType};
1010

1111
#[repr(u16)]
1212
enum CustomTrapCode {
@@ -286,7 +286,8 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
286286
self.store_variable(idx.get(arg), val)
287287
}
288288
Instruction::LoadConst { idx } => {
289-
let val = self.prepare_const(bytecode.constants[idx.get(arg) as usize].borrow_constant())?;
289+
let val = self
290+
.prepare_const(bytecode.constants[idx.get(arg) as usize].borrow_constant())?;
290291
self.stack.push(val);
291292
Ok(())
292293
}
@@ -315,7 +316,8 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
315316
self.return_value(val)
316317
}
317318
Instruction::ReturnConst { idx } => {
318-
let val = self.prepare_const(bytecode.constants[idx.get(arg) as usize].borrow_constant())?;
319+
let val = self
320+
.prepare_const(bytecode.constants[idx.get(arg) as usize].borrow_constant())?;
319321
self.return_value(val)
320322
}
321323
Instruction::CompareOperation { op, .. } => {
@@ -521,7 +523,7 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
521523
self.stack.push(JitValue::FuncRef(func_ref));
522524
Ok(())
523525
}
524-
},
526+
}
525527
Instruction::CallFunctionPositional { nargs } => {
526528
let nargs = nargs.get(arg);
527529

@@ -538,10 +540,10 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
538540
self.stack.push(JitValue::Int(returns[0]));
539541

540542
Ok(())
541-
},
543+
}
542544
_ => Err(JitCompileError::BadBytecode),
543545
}
544-
},
546+
}
545547
_ => Err(JitCompileError::NotSupported),
546548
}
547549
}

jit/src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Jit {
4949
&mut self,
5050
bytecode: &bytecode::CodeObject<C>,
5151
args: &[JitType],
52-
ret: Option<JitType>
52+
ret: Option<JitType>,
5353
) -> Result<(FuncId, JitSig), JitCompileError> {
5454
for arg in args {
5555
self.ctx
@@ -81,8 +81,13 @@ impl Jit {
8181
builder.switch_to_block(entry_block);
8282

8383
let sig = {
84-
let mut compiler =
85-
FunctionCompiler::new(&mut builder, bytecode.varnames.len(), args, ret, entry_block);
84+
let mut compiler = FunctionCompiler::new(
85+
&mut builder,
86+
bytecode.varnames.len(),
87+
args,
88+
ret,
89+
entry_block,
90+
);
8691

8792
compiler.compile(func_ref, bytecode)?;
8893

@@ -103,7 +108,7 @@ impl Jit {
103108
pub fn compile<C: bytecode::Constant>(
104109
bytecode: &bytecode::CodeObject<C>,
105110
args: &[JitType],
106-
ret: Option<JitType>
111+
ret: Option<JitType>,
107112
) -> Result<CompiledCode, JitCompileError> {
108113
let mut jit = Jit::new();
109114

0 commit comments

Comments
 (0)