Skip to content

Commit c568ddd

Browse files
committed
fmt
1 parent e8c8c75 commit c568ddd

File tree

4 files changed

+13
-34
lines changed

4 files changed

+13
-34
lines changed

crates/utils/re_mcap/src/parsers/ros2msg/reflection/deserialize/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ impl<'a, R: TypeResolver> SequenceSeed<'a, R> {
330330

331331
impl<'de, R: TypeResolver> DeserializeSeed<'de> for SequenceSeed<'_, R> {
332332
type Value = Vec<Value>;
333+
333334
fn deserialize<D>(self, de: D) -> Result<Self::Value, D::Error>
334335
where
335336
D: de::Deserializer<'de>,

crates/utils/re_mcap/src/parsers/ros2msg/reflection/deserialize/primitive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ macro_rules! impl_primitive_visitor {
1414
($t:ty, $m:ident) => {
1515
impl Visitor<'_> for PrimitiveVisitor<$t> {
1616
type Value = $t;
17+
1718
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1819
write!(f, stringify!($t))
1920
}
21+
2022
fn $m<E>(self, v: $t) -> Result<$t, E> {
2123
Ok(v)
2224
}

crates/utils/re_mcap/src/parsers/ros2msg/reflection/message_spec.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ impl Type {
343343

344344
fn parse_bounded_string_length(s: &str, prefix: &str) -> Result<usize, ParseError> {
345345
if let Some(len_str) = s.strip_prefix(prefix) {
346-
let len = len_str.parse::<usize>().map_err(|e| {
347-
ParseError::Type(format!("failed to parse bounded string length: {e}"))
346+
let len = len_str.parse::<usize>().map_err(|err| {
347+
ParseError::Type(format!("failed to parse bounded string length: {err}"))
348348
})?;
349349

350350
Ok(len)
@@ -422,8 +422,8 @@ impl ArraySize {
422422
} else if let Ok(size) = array_part.parse::<usize>() {
423423
Self::Fixed(size)
424424
} else if let Some(n) = array_part.strip_prefix("<=") {
425-
let size = n.parse::<usize>().map_err(|e| {
426-
ParseError::Value(format!("Failed to parse bounded array size: {e}"))
425+
let size = n.parse::<usize>().map_err(|err| {
426+
ParseError::Value(format!("Failed to parse bounded array size: {err}"))
427427
})?;
428428
Self::Bounded(size)
429429
} else {
@@ -466,20 +466,20 @@ impl Literal {
466466
},
467467
// Char is a signed 8-bit integer representing an ASCII character.
468468
Char | Int8 | Int16 | Int32 | Int64 => {
469-
s.parse::<i64>().map(Self::Int).map_err(|e| {
470-
ParseError::Value(format!("failed to parse integer literal `{s}`: {e}"))
469+
s.parse::<i64>().map(Self::Int).map_err(|err| {
470+
ParseError::Value(format!("failed to parse integer literal `{s}`: {err}"))
471471
})
472472
}
473473
// Byte is an unsigned 8-bit integer.
474474
Byte | UInt8 | UInt16 | UInt32 | UInt64 => {
475-
s.parse::<u64>().map(Self::UInt).map_err(|e| {
475+
s.parse::<u64>().map(Self::UInt).map_err(|err| {
476476
ParseError::Value(format!(
477-
"failed to parse unsigned integer literal `{s}`: {e}"
477+
"failed to parse unsigned integer literal `{s}`: {err}"
478478
))
479479
})
480480
}
481-
Float32 | Float64 => s.parse::<f64>().map(Self::Float).map_err(|e| {
482-
ParseError::Value(format!("failed to parse float literal `{s}`: {e}"))
481+
Float32 | Float64 => s.parse::<f64>().map(Self::Float).map_err(|err| {
482+
ParseError::Value(format!("failed to parse float literal `{s}`: {err}"))
483483
}),
484484
String(_) | WString(_) => {
485485
let s = if (s.starts_with('"') && s.ends_with('"'))

crates/utils/re_mcap/src/parsers/ros2msg/reflection/mod.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,3 @@ fn parse_section(lines: &[&str]) -> Option<(String, String)> {
107107

108108
Some((name.to_owned(), body))
109109
}
110-
111-
#[cfg(test)]
112-
mod tests {
113-
use super::*;
114-
115-
#[test]
116-
fn test_parse_message_spec() {
117-
let input = r#"
118-
# This is a comment
119-
std_msgs/Header header
120-
121-
int32 field1
122-
float64 field2 3.14
123-
string field3 "hello"
124-
uint8[] field4
125-
126-
geometry_msgs/Point[] field5
127-
128-
uint32 CONST1=42 # inline comment
129-
"#;
130-
131-
MessageSpecification::parse("test", input).unwrap();
132-
}
133-
}

0 commit comments

Comments
 (0)