diff --git a/vm/src/obj/objcode.rs b/vm/src/obj/objcode.rs index 757e1aca3..f8cdcb22a 100644 --- a/vm/src/obj/objcode.rs +++ b/vm/src/obj/objcode.rs @@ -27,7 +27,7 @@ pub fn copy_code(code_obj: &PyObjectRef) -> bytecode::CodeObject { fn code_new(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { arg_check!(vm, args, required = [(_cls, None)]); - Err(vm.new_type_error(format!("Cannot directly create code object"))) + Err(vm.new_type_error("Cannot directly create code object".to_string())) } fn code_repr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { @@ -43,7 +43,7 @@ fn code_repr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { }; // TODO: fetch proper line info from code object - let line = format!(", line 1"); + let line = ", line 1".to_string(); let repr = format!("", file, line); Ok(vm.new_str(repr)) diff --git a/vm/src/obj/objframe.rs b/vm/src/obj/objframe.rs index c9aa366b1..e0e0d8d15 100644 --- a/vm/src/obj/objframe.rs +++ b/vm/src/obj/objframe.rs @@ -19,12 +19,12 @@ pub fn init(context: &PyContext) { fn frame_new(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { arg_check!(vm, args, required = [(_cls, None)]); - Err(vm.new_type_error(format!("Cannot directly create frame object"))) + Err(vm.new_type_error("Cannot directly create frame object".to_string())) } fn frame_repr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { arg_check!(vm, args, required = [(_frame, Some(vm.ctx.frame_type()))]); - let repr = format!(""); + let repr = "".to_string(); Ok(vm.new_str(repr)) } diff --git a/vm/src/obj/objsuper.rs b/vm/src/obj/objsuper.rs index 850f64c1a..4929042bb 100644 --- a/vm/src/obj/objsuper.rs +++ b/vm/src/obj/objsuper.rs @@ -53,9 +53,9 @@ fn super_init(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { // Check obj type: if !(objtype::isinstance(&py_obj, &py_type) || objtype::issubclass(&py_obj, &py_type)) { - return Err(vm.new_type_error(format!( - "super(type, obj): obj must be an instance or subtype of type" - ))); + return Err(vm.new_type_error( + "super(type, obj): obj must be an instance or subtype of type".to_string(), + )); } // TODO: how to store those types? diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index 69fc083a5..b91b519c9 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -1037,13 +1037,13 @@ impl PyObject { dict: ref _dict, mro: _, } => format!("", name), - PyObjectPayload::Instance { dict: _ } => format!(""), - PyObjectPayload::Code { code: _ } => format!(""), - PyObjectPayload::Function { .. } => format!(""), - PyObjectPayload::Generator { .. } => format!(""), - PyObjectPayload::Frame { .. } => format!(""), - PyObjectPayload::BoundMethod { .. } => format!(""), - PyObjectPayload::RustFunction { function: _ } => format!(""), + PyObjectPayload::Instance { dict: _ } => "".to_string(), + PyObjectPayload::Code { code: _ } => "".to_string(), + PyObjectPayload::Function { .. } => "".to_string(), + PyObjectPayload::Generator { .. } => "".to_string(), + PyObjectPayload::Frame { .. } => "".to_string(), + PyObjectPayload::BoundMethod { .. } => "".to_string(), + PyObjectPayload::RustFunction { function: _ } => "".to_string(), PyObjectPayload::Module { ref name, dict: _ } => format!("", name), PyObjectPayload::Scope { ref scope } => format!("", scope), PyObjectPayload::Slice { diff --git a/vm/src/stdlib/pystruct.rs b/vm/src/stdlib/pystruct.rs index fda1854f4..4640af759 100644 --- a/vm/src/stdlib/pystruct.rs +++ b/vm/src/stdlib/pystruct.rs @@ -76,7 +76,7 @@ fn pack_bool( data.write_u8(v).unwrap(); Ok(()) } else { - Err(vm.new_type_error(format!("Expected boolean"))) + Err(vm.new_type_error("Expected boolean".to_string())) } } @@ -150,7 +150,7 @@ fn pack_f32( data.write_f32::(v).unwrap(); Ok(()) } else { - Err(vm.new_type_error(format!("Expected float"))) + Err(vm.new_type_error("Expected float".to_string())) } } @@ -164,7 +164,7 @@ fn pack_f64( data.write_f64::(v).unwrap(); Ok(()) } else { - Err(vm.new_type_error(format!("Expected float"))) + Err(vm.new_type_error("Expected float".to_string())) } } @@ -216,7 +216,7 @@ fn struct_pack(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { ))) } } else { - Err(vm.new_type_error(format!("First argument must be of str type"))) + Err(vm.new_type_error("First argument must be of str type".to_string())) } } }