Minor clippy fix.

This commit is contained in:
Windel Bouwman
2019-03-02 11:22:40 +01:00
parent 8f52e15d32
commit 7bb6f8fdaa
4 changed files with 15 additions and 8 deletions

View File

@@ -190,7 +190,7 @@ pub enum Constant {
Boolean { value: bool },
String { value: String },
Bytes { value: Vec<u8> },
Code { code: CodeObject },
Code { code: Box<CodeObject> },
Tuple { elements: Vec<Constant> },
None,
}

View File

@@ -603,7 +603,9 @@ impl Compiler {
self.prepare_decorators(decorator_list)?;
self.emit(Instruction::LoadConst {
value: bytecode::Constant::Code { code },
value: bytecode::Constant::Code {
code: Box::new(code),
},
});
self.emit(Instruction::LoadConst {
value: bytecode::Constant::String {
@@ -653,7 +655,9 @@ impl Compiler {
let code = self.pop_code_object();
self.emit(Instruction::LoadConst {
value: bytecode::Constant::Code { code },
value: bytecode::Constant::Code {
code: Box::new(code),
},
});
self.emit(Instruction::LoadConst {
value: bytecode::Constant::String {
@@ -1075,7 +1079,9 @@ impl Compiler {
self.emit(Instruction::ReturnValue);
let code = self.pop_code_object();
self.emit(Instruction::LoadConst {
value: bytecode::Constant::Code { code },
value: bytecode::Constant::Code {
code: Box::new(code),
},
});
self.emit(Instruction::LoadConst {
value: bytecode::Constant::String { value: name },
@@ -1360,7 +1366,9 @@ impl Compiler {
// List comprehension code:
self.emit(Instruction::LoadConst {
value: bytecode::Constant::Code { code },
value: bytecode::Constant::Code {
code: Box::new(code),
},
});
// List comprehension function name:

View File

@@ -716,8 +716,7 @@ impl Frame {
let obj = import_module(vm, current_path, module)?;
for (k, v) in obj.get_key_value_pairs().iter() {
&self
.scope
self.scope
.locals
.set_item(&vm.ctx, &objstr::get_value(k), v.clone());
}

View File

@@ -682,7 +682,7 @@ impl PyContext {
bytecode::Constant::String { ref value } => self.new_str(value.clone()),
bytecode::Constant::Bytes { ref value } => self.new_bytes(value.clone()),
bytecode::Constant::Boolean { ref value } => self.new_bool(value.clone()),
bytecode::Constant::Code { ref code } => self.new_code_object(code.clone()),
bytecode::Constant::Code { ref code } => self.new_code_object(*code.clone()),
bytecode::Constant::Tuple { ref elements } => {
let elements = elements
.iter()