Skip to content

Commit 0d3b218

Browse files
committed
Fixed the 'toplevel_ref_arg' clippy warning
This replaces all the occurrences of the 'let ref var = another_var' with the 'let var = &another_var' Relevant clippy warning: https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg
1 parent 7941480 commit 0d3b218

22 files changed

Lines changed: 28 additions & 27 deletions

vm/src/obj/objbool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ pub fn boolval(vm: &mut VirtualMachine, obj: PyObjectRef) -> Result<bool, PyObje
3030
}
3131

3232
pub fn init(context: &PyContext) {
33-
let ref bool_type = context.bool_type;
3433
let bool_doc = "bool(x) -> bool
3534
3635
Returns True when the argument x is true, False otherwise.
3736
The builtins True and False are the only two instances of the class bool.
3837
The class bool is a subclass of the class int, and cannot be subclassed.";
3938

39+
let bool_type = &context.bool_type;
4040
context.set_attr(&bool_type, "__new__", context.new_rustfunc(bool_new));
4141
context.set_attr(&bool_type, "__repr__", context.new_rustfunc(bool_repr));
4242
context.set_attr(&bool_type, "__doc__", context.new_str(bool_doc.to_string()));

vm/src/obj/objbytearray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use num_traits::ToPrimitive;
1616

1717
/// Fill bytearray class methods dictionary.
1818
pub fn init(context: &PyContext) {
19-
let ref bytearray_type = context.bytearray_type;
19+
let bytearray_type = &context.bytearray_type;
2020
context.set_attr(
2121
&bytearray_type,
2222
"__eq__",

vm/src/obj/objbytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::ops::Deref;
1414

1515
// Fill bytes class methods:
1616
pub fn init(context: &PyContext) {
17-
let ref bytes_type = context.bytes_type;
17+
let bytes_type = &context.bytes_type;
1818
context.set_attr(bytes_type, "__eq__", context.new_rustfunc(bytes_eq));
1919
context.set_attr(bytes_type, "__hash__", context.new_rustfunc(bytes_hash));
2020
context.set_attr(bytes_type, "__new__", context.new_rustfunc(bytes_new));

vm/src/obj/objcode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::super::vm::VirtualMachine;
1010
use super::objtype;
1111

1212
pub fn init(context: &PyContext) {
13-
let ref code_type = context.code_type;
13+
let code_type = &context.code_type;
1414
context.set_attr(code_type, "__new__", context.new_rustfunc(code_new));
1515
context.set_attr(code_type, "__repr__", context.new_rustfunc(code_repr));
1616
}

vm/src/obj/objcomplex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::objtype;
77
use num_complex::Complex64;
88

99
pub fn init(context: &PyContext) {
10-
let ref complex_type = context.complex_type;
10+
let complex_type = &context.complex_type;
1111
context.set_attr(&complex_type, "__add__", context.new_rustfunc(complex_add));
1212
context.set_attr(&complex_type, "__new__", context.new_rustfunc(complex_new));
1313
context.set_attr(

vm/src/obj/objdict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub fn create_type(type_type: PyObjectRef, object_type: PyObjectRef, dict_type:
284284
}
285285

286286
pub fn init(context: &PyContext) {
287-
let ref dict_type = context.dict_type;
287+
let dict_type = &context.dict_type;
288288
context.set_attr(&dict_type, "__len__", context.new_rustfunc(dict_len));
289289
context.set_attr(
290290
&dict_type,

vm/src/obj/objfloat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn float_pow(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
267267
}
268268

269269
pub fn init(context: &PyContext) {
270-
let ref float_type = context.float_type;
270+
let float_type = &context.float_type;
271271
context.set_attr(&float_type, "__eq__", context.new_rustfunc(float_eq));
272272
context.set_attr(&float_type, "__lt__", context.new_rustfunc(float_lt));
273273
context.set_attr(&float_type, "__le__", context.new_rustfunc(float_le));

vm/src/obj/objframe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::super::vm::VirtualMachine;
1010
use super::objtype;
1111

1212
pub fn init(context: &PyContext) {
13-
let ref frame_type = context.frame_type;
13+
let frame_type = &context.frame_type;
1414
context.set_attr(&frame_type, "__new__", context.new_rustfunc(frame_new));
1515
context.set_attr(&frame_type, "__repr__", context.new_rustfunc(frame_repr));
1616
context.set_attr(&frame_type, "f_locals", context.new_property(frame_flocals));

vm/src/obj/objfunction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ use super::super::vm::VirtualMachine;
66
use super::objtype;
77

88
pub fn init(context: &PyContext) {
9-
let ref function_type = context.function_type;
9+
let function_type = &context.function_type;
1010
context.set_attr(&function_type, "__get__", context.new_rustfunc(bind_method));
1111

12-
let ref member_descriptor_type = context.member_descriptor_type;
12+
let member_descriptor_type = &context.member_descriptor_type;
1313
context.set_attr(
1414
&member_descriptor_type,
1515
"__get__",
1616
context.new_rustfunc(member_get),
1717
);
1818

19-
let ref classmethod_type = context.classmethod_type;
19+
let classmethod_type = &context.classmethod_type;
2020
context.set_attr(
2121
&classmethod_type,
2222
"__get__",
@@ -28,7 +28,7 @@ pub fn init(context: &PyContext) {
2828
context.new_rustfunc(classmethod_new),
2929
);
3030

31-
let ref staticmethod_type = context.staticmethod_type;
31+
let staticmethod_type = &context.staticmethod_type;
3232
context.set_attr(
3333
staticmethod_type,
3434
"__get__",

vm/src/obj/objgenerator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::super::vm::VirtualMachine;
1010
use super::objtype;
1111

1212
pub fn init(context: &PyContext) {
13-
let ref generator_type = context.generator_type;
13+
let generator_type = &context.generator_type;
1414
context.set_attr(
1515
&generator_type,
1616
"__iter__",

0 commit comments

Comments
 (0)