Skip to content

Commit 26fdae3

Browse files
committed
cargo fmt
1 parent a8e2515 commit 26fdae3

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

crates/core/src/abi.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
13721372
}
13731373
TypeDefKind::Unknown => unreachable!(),
13741374
TypeDefKind::FixedSizeList(ty, size) => {
1375-
self.emit(&FixedSizeListLower { elements: ty, size: *size, id });
1375+
self.emit(&FixedSizeListLower {
1376+
elements: ty,
1377+
size: *size,
1378+
id,
1379+
});
13761380
let mut values = self
13771381
.stack
13781382
.drain(self.stack.len() - (*size as usize)..)
@@ -1588,7 +1592,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
15881592
self.stack.extend(args.drain(..temp.len()));
15891593
self.lift(ty);
15901594
}
1591-
self.emit(&FixedSizeListLift { elements: ty, size: *size, id });
1595+
self.emit(&FixedSizeListLift {
1596+
elements: ty,
1597+
size: *size,
1598+
id,
1599+
});
15921600
}
15931601
},
15941602
}
@@ -1757,7 +1765,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
17571765
self.write_to_memory(ty, addr.clone(), position);
17581766
position = position + increment;
17591767
}
1760-
self.emit(&FixedSizeListLower { elements: ty, size: *size, id });
1768+
self.emit(&FixedSizeListLower {
1769+
elements: ty,
1770+
size: *size,
1771+
id,
1772+
});
17611773
}
17621774
},
17631775
}
@@ -1952,7 +1964,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
19521964
self.read_from_memory(ty, addr.clone(), position);
19531965
position = position + increment;
19541966
}
1955-
self.emit(&FixedSizeListLift { elements: ty, size: *size, id });
1967+
self.emit(&FixedSizeListLift {
1968+
elements: ty,
1969+
size: *size,
1970+
id,
1971+
});
19561972
}
19571973
},
19581974
}

crates/core/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ pub trait AnonymousTypeGenerator<'a> {
217217
TypeDefKind::Stream(s) => self.anonymous_type_stream(id, s, &ty.docs),
218218
TypeDefKind::Handle(handle) => self.anonymous_type_handle(id, handle, &ty.docs),
219219
TypeDefKind::Unknown => unreachable!(),
220-
TypeDefKind::FixedSizeList(t, size) => self.anonymous_type_fixed_size_list(id, t, *size, &ty.docs),
220+
TypeDefKind::FixedSizeList(t, size) => {
221+
self.anonymous_type_fixed_size_list(id, t, *size, &ty.docs)
222+
}
221223
}
222224
}
223225
}

crates/rust/src/bindgen.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,20 +1202,26 @@ impl Bindgen for FunctionBindgen<'_, '_> {
12021202
align = align.format(POINTER_SIZE_EXPRESSION)
12031203
));
12041204
}
1205-
Instruction::FixedSizeListLift { elements: _, size, id: _ } => {
1205+
Instruction::FixedSizeListLift {
1206+
elements: _,
1207+
size,
1208+
id: _,
1209+
} => {
12061210
let tmp = self.tmp();
12071211
let result = format!("result{tmp}");
1208-
self.push_str(&format!(
1209-
"let mut {result} = [",
1210-
));
1212+
self.push_str(&format!("let mut {result} = [",));
12111213
for a in operands.drain(0..(*size as usize)) {
12121214
self.push_str(&a);
12131215
self.push_str(", ");
12141216
}
12151217
self.push_str("];\n");
12161218
results.push(result);
12171219
}
1218-
Instruction::FixedSizeListLower { elements: _, size, id: _ } => {
1220+
Instruction::FixedSizeListLower {
1221+
elements: _,
1222+
size,
1223+
id: _,
1224+
} => {
12191225
for i in 0..(*size as usize) {
12201226
results.push(format!("{}[{i}]", operands[0]));
12211227
}

crates/rust/src/interface.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,10 +2932,17 @@ impl<'a, 'b> wit_bindgen_core::AnonymousTypeGenerator<'a> for AnonTypeGenerator<
29322932
self.interface.print_optional_ty(ty.as_ref(), mode);
29332933
self.interface.push_str(">");
29342934
}
2935-
2935+
29362936
fn anonymous_type_fixed_size_list(&mut self, _id: TypeId, ty: &Type, size: u32, _docs: &Docs) {
29372937
self.interface.push_str("[");
2938-
self.interface.print_ty(ty, TypeMode{ lifetime: None, lists_borrowed: false, style: TypeOwnershipStyle::Owned });
2938+
self.interface.print_ty(
2939+
ty,
2940+
TypeMode {
2941+
lifetime: None,
2942+
lists_borrowed: false,
2943+
style: TypeOwnershipStyle::Owned,
2944+
},
2945+
);
29392946
self.interface.push_str(&format!(", {size}]"));
29402947
}
29412948
}

0 commit comments

Comments
 (0)