Skip to content

Commit f87010d

Browse files
committed
cargo fmt
1 parent df55ccd commit f87010d

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
@@ -1402,7 +1402,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
14021402
}
14031403
TypeDefKind::Unknown => unreachable!(),
14041404
TypeDefKind::FixedSizeList(ty, size) => {
1405-
self.emit(&FixedSizeListLower { elements: ty, size: *size, id });
1405+
self.emit(&FixedSizeListLower {
1406+
elements: ty,
1407+
size: *size,
1408+
id,
1409+
});
14061410
let mut values = self
14071411
.stack
14081412
.drain(self.stack.len() - (*size as usize)..)
@@ -1611,7 +1615,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
16111615
self.stack.extend(args.drain(..temp.len()));
16121616
self.lift(ty);
16131617
}
1614-
self.emit(&FixedSizeListLift { elements: ty, size: *size, id });
1618+
self.emit(&FixedSizeListLift {
1619+
elements: ty,
1620+
size: *size,
1621+
id,
1622+
});
16151623
}
16161624
},
16171625
}
@@ -1777,7 +1785,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
17771785
self.write_to_memory(ty, addr.clone(), position);
17781786
position = position + increment;
17791787
}
1780-
self.emit(&FixedSizeListLower { elements: ty, size: *size, id });
1788+
self.emit(&FixedSizeListLower {
1789+
elements: ty,
1790+
size: *size,
1791+
id,
1792+
});
17811793
}
17821794
},
17831795
}
@@ -1972,7 +1984,11 @@ impl<'a, B: Bindgen> Generator<'a, B> {
19721984
self.read_from_memory(ty, addr.clone(), position);
19731985
position = position + increment;
19741986
}
1975-
self.emit(&FixedSizeListLift { elements: ty, size: *size, id });
1987+
self.emit(&FixedSizeListLift {
1988+
elements: ty,
1989+
size: *size,
1990+
id,
1991+
});
19761992
}
19771993
},
19781994
}

crates/core/src/lib.rs

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

crates/rust/src/bindgen.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,20 +1207,26 @@ impl Bindgen for FunctionBindgen<'_, '_> {
12071207
Instruction::DropHandle { .. } => {
12081208
uwriteln!(self.src, "let _ = {};", operands[0]);
12091209
}
1210-
Instruction::FixedSizeListLift { elements: _, size, id: _ } => {
1210+
Instruction::FixedSizeListLift {
1211+
elements: _,
1212+
size,
1213+
id: _,
1214+
} => {
12111215
let tmp = self.tmp();
12121216
let result = format!("result{tmp}");
1213-
self.push_str(&format!(
1214-
"let mut {result} = [",
1215-
));
1217+
self.push_str(&format!("let mut {result} = [",));
12161218
for a in operands.drain(0..(*size as usize)) {
12171219
self.push_str(&a);
12181220
self.push_str(", ");
12191221
}
12201222
self.push_str("];\n");
12211223
results.push(result);
12221224
}
1223-
Instruction::FixedSizeListLower { elements: _, size, id: _ } => {
1225+
Instruction::FixedSizeListLower {
1226+
elements: _,
1227+
size,
1228+
id: _,
1229+
} => {
12241230
for i in 0..(*size as usize) {
12251231
results.push(format!("{}[{i}]", operands[0]));
12261232
}

crates/rust/src/interface.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,10 +2919,17 @@ impl<'a, 'b> wit_bindgen_core::AnonymousTypeGenerator<'a> for AnonTypeGenerator<
29192919
self.interface.print_optional_ty(ty.as_ref(), mode);
29202920
self.interface.push_str(">");
29212921
}
2922-
2922+
29232923
fn anonymous_type_fixed_size_list(&mut self, _id: TypeId, ty: &Type, size: u32, _docs: &Docs) {
29242924
self.interface.push_str("[");
2925-
self.interface.print_ty(ty, TypeMode{ lifetime: None, lists_borrowed: false, style: TypeOwnershipStyle::Owned });
2925+
self.interface.print_ty(
2926+
ty,
2927+
TypeMode {
2928+
lifetime: None,
2929+
lists_borrowed: false,
2930+
style: TypeOwnershipStyle::Owned,
2931+
},
2932+
);
29262933
self.interface.push_str(&format!(", {size}]"));
29272934
}
29282935
}

0 commit comments

Comments
 (0)