Skip to content

Commit

Permalink
Fix debug names of values.
Browse files Browse the repository at this point in the history
  • Loading branch information
nihohit committed Dec 11, 2023
1 parent 63011d6 commit 0bee22c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions redis/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,13 @@ impl fmt::Debug for Value {
Value::Nil => write!(fmt, "nil"),
Value::Int(val) => write!(fmt, "int({val:?})"),
Value::BulkString(ref val) => match from_utf8(val) {
Ok(x) => write!(fmt, "string-data('{x:?}')"),
Ok(x) => write!(fmt, "bulk-string('{x:?}')"),
Err(_) => write!(fmt, "binary-data({val:?})"),
},
Value::Array(ref values) => write!(fmt, "bulk({values:?})"),
Value::Array(ref values) => write!(fmt, "array({values:?})"),
Value::Push { ref kind, ref data } => write!(fmt, "push({kind:?}, {data:?})"),
Value::Okay => write!(fmt, "ok"),
Value::SimpleString(ref s) => write!(fmt, "status({s:?})"),
Value::SimpleString(ref s) => write!(fmt, "simple-string({s:?})"),
Value::Map(ref values) => write!(fmt, "map({values:?})"),
Value::Attribute {
ref data,
Expand Down
4 changes: 2 additions & 2 deletions redis/tests/test_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn test_box_slice() {
Box::<[i32]>::from_redis_value(
&Value::BulkString("just a string".into())
).unwrap_err().to_string(),
"Response was of incompatible type - TypeError: \"Conversion to alloc::boxed::Box<[i32]> failed.\" (response was string-data('\"just a string\"'))",
"Response was of incompatible type - TypeError: \"Conversion to alloc::boxed::Box<[i32]> failed.\" (response was bulk-string('\"just a string\"'))",
);
}

Expand Down Expand Up @@ -145,7 +145,7 @@ fn test_arc_slice() {
Arc::<[i32]>::from_redis_value(
&Value::BulkString("just a string".into())
).unwrap_err().to_string(),
"Response was of incompatible type - TypeError: \"Conversion to alloc::sync::Arc<[i32]> failed.\" (response was string-data('\"just a string\"'))",
"Response was of incompatible type - TypeError: \"Conversion to alloc::sync::Arc<[i32]> failed.\" (response was bulk-string('\"just a string\"'))",
);
}

Expand Down

0 comments on commit 0bee22c

Please sign in to comment.