Skip to content

Commit 4546c13

Browse files
authored
Use Display for DataTypes, not Debug formatting (#11219)
1 parent 0c9ac82 commit 4546c13

File tree

13 files changed

+22
-18
lines changed

13 files changed

+22
-18
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7421,6 +7421,7 @@ dependencies = [
74217421
"egui_extras",
74227422
"itertools 0.14.0",
74237423
"re_arrow_ui",
7424+
"re_arrow_util",
74247425
"re_byte_size",
74257426
"re_chunk_store",
74267427
"re_format",

crates/store/re_data_loader/src/loader_lerobot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ fn make_scalar_entity_chunk(
600600
fn extract_scalar_slices_as_f64(data: &ArrayRef) -> anyhow::Result<Vec<ArrayRef>> {
601601
// cast the slice to f64 first, as scalars need an f64
602602
let scalar_values = cast(&data, &DataType::Float64)
603-
.with_context(|| format!("Failed to cast {:?} to Float64", data.data_type()))?;
603+
.with_context(|| format!("Failed to cast {} to Float64", data.data_type()))?;
604604

605605
Ok((0..data.len())
606606
.map(|idx| scalar_values.slice(idx, 1))
@@ -613,7 +613,7 @@ fn extract_fixed_size_list_array_elements_as_f64(
613613
(0..data.len())
614614
.map(|idx| {
615615
cast(&data.value(idx), &DataType::Float64)
616-
.with_context(|| format!("Failed to cast {:?} to Float64", data.data_type()))
616+
.with_context(|| format!("Failed to cast {} to Float64", data.data_type()))
617617
})
618618
.collect::<Result<Vec<_>, _>>()
619619
}
@@ -624,7 +624,7 @@ fn extract_list_array_elements_as_f64(
624624
(0..data.len())
625625
.map(|idx| {
626626
cast(&data.value(idx), &DataType::Float64)
627-
.with_context(|| format!("Failed to cast {:?} to Float64", data.data_type()))
627+
.with_context(|| format!("Failed to cast {} to Float64", data.data_type()))
628628
})
629629
.collect::<Result<Vec<_>, _>>()
630630
}

crates/store/re_sorbet/src/index_column_descriptor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use re_log_types::{Timeline, TimelineName};
55
use crate::MetadataExt as _;
66

77
#[derive(thiserror::Error, Debug)]
8-
#[error("Unsupported time type: {datatype:?}")]
8+
#[error("Unsupported time type: {datatype}")]
99
pub struct UnsupportedTimeType {
1010
pub datatype: ArrowDatatype,
1111
}

crates/store/re_sorbet/src/row_id_column_descriptor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl TryFrom<&ArrowField> for RowIdColumnDescriptor {
8686
})
8787
} else {
8888
Err(WrongDatatypeError(format!(
89-
"Expected a RowId column with datatype {expected_datatype:?}, but column {:?} has datatype {actual_datatype:?}",
89+
"Expected a RowId column with datatype {expected_datatype}, but column {:?} has datatype {actual_datatype}",
9090
field.name()
9191
)))
9292
}

crates/store/re_types/src/archetypes/depth_image_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl DepthImage {
5050
let num_expected_bytes = image_format.num_bytes();
5151
if buffer.len() != num_expected_bytes {
5252
re_log::warn_once!(
53-
"Expected {width}x{height} {} {datatype:?} image to be {num_expected_bytes} B, but got {} B",
53+
"Expected {width}x{height} {} {datatype} image to be {num_expected_bytes} B, but got {} B",
5454
ColorModel::L,
5555
buffer.len()
5656
);

crates/store/re_types/src/archetypes/image_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl Image {
9999
let num_expected_bytes = image_format.num_bytes();
100100
if buffer.len() != num_expected_bytes {
101101
re_log::warn_once!(
102-
"Expected {width}x{height} {color_model:?} {datatype:?} image to be {num_expected_bytes} B, but got {} B",
102+
"Expected {width}x{height} {color_model:?} {datatype} image to be {num_expected_bytes} B, but got {} B",
103103
buffer.len()
104104
);
105105
}

crates/store/re_types/src/components/image_buffer_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl ImageBuffer {
2020
let num_expected_bytes = image_format.num_bytes();
2121
if bytes.len() != num_expected_bytes {
2222
re_log::warn_once!(
23-
"Expected {width}x{height} {color_model:?} {datatype:?} image to be {num_expected_bytes} B, but got {} B",
23+
"Expected {width}x{height} {color_model:?} {datatype} image to be {num_expected_bytes} B, but got {} B",
2424
bytes.len()
2525
);
2626
}

crates/store/re_types_core/src/reflection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn generic_placeholder_for_datatype(
9595

9696
TimeUnit::Microsecond | TimeUnit::Nanosecond => {
9797
re_log::debug_once!(
98-
"Attempted to create a placeholder for out-of-spec datatype: {datatype:?}"
98+
"Attempted to create a placeholder for out-of-spec datatype: {datatype}"
9999
);
100100
array::new_empty_array(datatype)
101101
}
@@ -112,7 +112,7 @@ pub fn generic_placeholder_for_datatype(
112112

113113
TimeUnit::Second | TimeUnit::Millisecond => {
114114
re_log::debug_once!(
115-
"Attempted to create a placeholder for out-of-spec datatype: {datatype:?}"
115+
"Attempted to create a placeholder for out-of-spec datatype: {datatype}"
116116
);
117117
array::new_empty_array(datatype)
118118
}
@@ -198,7 +198,7 @@ pub fn generic_placeholder_for_datatype(
198198
{
199199
Arc::new(array::FixedSizeListArray::from(list_data))
200200
} else {
201-
re_log::warn_once!("Bug in FixedSizeListArray of {:?}", field.data_type());
201+
re_log::warn_once!("Bug in FixedSizeListArray of {}", field.data_type());
202202
array::new_empty_array(datatype)
203203
}
204204
}
@@ -245,7 +245,7 @@ pub fn generic_placeholder_for_datatype(
245245
| DataType::LargeListView { .. }
246246
| DataType::RunEndEncoded { .. } => {
247247
// TODO(emilk)
248-
re_log::debug_once!("Unimplemented: placeholder value for: {datatype:?}");
248+
re_log::debug_once!("Unimplemented: placeholder value for: {datatype}");
249249
array::new_empty_array(datatype) // TODO(emilk)
250250
}
251251
}

crates/store/re_types_core/src/result.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub enum DeserializationError {
142142
#[error("Expected non-nullable data but didn't find any")]
143143
MissingData { backtrace: Box<_Backtrace> },
144144

145-
#[error("Expected field {field_name:?} to be present in {datatype:#?}")]
145+
#[error("Expected field {field_name:?} to be present in {datatype}")]
146146
MissingStructField {
147147
datatype: arrow::datatypes::DataType,
148148
field_name: String,
@@ -160,15 +160,15 @@ pub enum DeserializationError {
160160
backtrace: Box<_Backtrace>,
161161
},
162162

163-
#[error("Expected union arm {arm_name:?} (#{arm_index}) to be present in {datatype:#?}")]
163+
#[error("Expected union arm {arm_name:?} (#{arm_index}) to be present in {datatype}")]
164164
MissingUnionArm {
165165
datatype: arrow::datatypes::DataType,
166166
arm_name: String,
167167
arm_index: usize,
168168
backtrace: Box<_Backtrace>,
169169
},
170170

171-
#[error("Expected {expected:#?} but found {got:#?} instead")]
171+
#[error("Expected {expected} but found {got} instead")]
172172
DatatypeMismatch {
173173
expected: arrow::datatypes::DataType,
174174
got: arrow::datatypes::DataType,

crates/top/rerun/src/commands/rrd/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Verifier {
140140
}
141141

142142
let list_array = column.as_list_opt::<i32>().ok_or_else(|| {
143-
anyhow::anyhow!("Expected list array, found {:?}", column.data_type())
143+
anyhow::anyhow!("Expected list array, found {}", column.data_type())
144144
})?;
145145

146146
assert_eq!(column.len() + 1, list_array.offsets().len());

0 commit comments

Comments
 (0)