Skip to content

Commit 2df9d79

Browse files
committed
Fix formatting errors
1 parent 9ec2eef commit 2df9d79

1 file changed

Lines changed: 51 additions & 9 deletions

File tree

vm/src/obj/objset.rs

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,56 @@ pub fn set_contains(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
127127
}
128128

129129
fn set_eq(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
130-
return set_compare_inner(vm, args, &|zelf: usize, other: usize| -> bool {zelf != other}, false)
130+
return set_compare_inner(
131+
vm,
132+
args,
133+
&|zelf: usize, other: usize| -> bool { zelf != other },
134+
false,
135+
);
131136
}
132137

133138
fn set_ge(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
134-
return set_compare_inner(vm, args, &|zelf: usize, other: usize| -> bool {zelf < other}, false)
139+
return set_compare_inner(
140+
vm,
141+
args,
142+
&|zelf: usize, other: usize| -> bool { zelf < other },
143+
false,
144+
);
135145
}
136146

137147
fn set_gt(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
138-
return set_compare_inner(vm, args, &|zelf: usize, other: usize| -> bool {zelf <= other}, false)
148+
return set_compare_inner(
149+
vm,
150+
args,
151+
&|zelf: usize, other: usize| -> bool { zelf <= other },
152+
false,
153+
);
139154
}
140155

141156
fn set_le(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
142-
return set_compare_inner(vm, args, &|zelf: usize, other: usize| -> bool {zelf < other}, true)
157+
return set_compare_inner(
158+
vm,
159+
args,
160+
&|zelf: usize, other: usize| -> bool { zelf < other },
161+
true,
162+
);
143163
}
144164

145165
fn set_lt(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
146-
return set_compare_inner(vm, args, &|zelf: usize, other: usize| -> bool {zelf <= other}, true)
166+
return set_compare_inner(
167+
vm,
168+
args,
169+
&|zelf: usize, other: usize| -> bool { zelf <= other },
170+
true,
171+
);
147172
}
148173

149-
fn set_compare_inner(vm: &mut VirtualMachine, args: PyFuncArgs, size_func: &Fn(usize, usize) -> bool, swap: bool) -> PyResult {
174+
fn set_compare_inner(
175+
vm: &mut VirtualMachine,
176+
args: PyFuncArgs,
177+
size_func: &Fn(usize, usize) -> bool,
178+
swap: bool,
179+
) -> PyResult {
150180
arg_check!(
151181
vm,
152182
args,
@@ -156,13 +186,25 @@ fn set_compare_inner(vm: &mut VirtualMachine, args: PyFuncArgs, size_func: &Fn(u
156186
]
157187
);
158188

159-
let get_zelf = |swap: bool| -> &PyObjectRef {if swap {other} else {zelf}};
160-
let get_other = |swap: bool| -> &PyObjectRef {if swap {zelf} else {other}};
189+
let get_zelf = |swap: bool| -> &PyObjectRef {
190+
if swap {
191+
other
192+
} else {
193+
zelf
194+
}
195+
};
196+
let get_other = |swap: bool| -> &PyObjectRef {
197+
if swap {
198+
zelf
199+
} else {
200+
other
201+
}
202+
};
161203

162204
let zelf_elements = get_elements(get_zelf(swap));
163205
let other_elements = get_elements(get_other(swap));
164206
if size_func(zelf_elements.len(), other_elements.len()) {
165-
return Ok(vm.new_bool(false));
207+
return Ok(vm.new_bool(false));
166208
}
167209
for element in other_elements.iter() {
168210
match vm.call_method(get_zelf(swap), "__contains__", vec![element.1.clone()]) {

0 commit comments

Comments
 (0)