Skip to content

Commit fbb0f2c

Browse files
committed
don't panic here anymore
1 parent f34d4e8 commit fbb0f2c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

crates/byondapi-rs-test/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ fn test_new_obj() -> Result<ByondValue> {
247247
///Tests macro style binds
248248
#[byondapi::bind_macro]
249249
fn test_new_obj_macro(
250-
object: ByondValue,
251-
number: ByondValue,
252-
thing: ByondValue,
250+
_object: ByondValue,
251+
_number: ByondValue,
252+
_thing: ByondValue,
253253
) -> Result<ByondValue> {
254254
Ok(ByondValue::builtin_new(
255255
ByondValue::try_from("/datum/testobject")?,

crates/byondapi-rs/src/value/trait_impls.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ impl PartialEq for ByondValue {
1313
// Debug!
1414
impl Debug for ByondValue {
1515
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16-
let type_enum: ValueType = self
17-
.0
18-
.type_
19-
.try_into()
20-
.unwrap_or_else(|_| panic!("Unimplemented type: {:X}", self.0.type_));
16+
let Ok(type_enum) = self.0.type_.try_into() else {
17+
return f
18+
.debug_tuple("ByondValue")
19+
.field(&format!("Unknown type: {:X}", self.0.type_))
20+
.finish();
21+
};
2122
let typ = format!("{type_enum:?}");
2223

2324
let value = match type_enum {

0 commit comments

Comments
 (0)