Skip to content

Commit b1e98af

Browse files
committed
Add underscores before type suffix
1 parent 71e7882 commit b1e98af

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/includes/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ pub enum CanError {
55
/// Signal parameter is not within the range
66
/// defined in the dbc
77
ParameterOutOfRange {
8-
/// Minimum value defined in DBC for signal
8+
/// Minimum value defined in DBC
99
min: f64,
10-
/// Maximum value defined in DBC for signal
10+
/// Maximum value defined in DBC
1111
max: f64,
1212
},
1313
InvalidPayloadSize,

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ fn render_signal(mut w: impl Write, signal: &Signal, dbc: &DBC, msg: &Message) -
382382
writeln!(w, r##"#[cfg(feature = "range_checked")]"##)?;
383383
writeln!(
384384
w,
385-
r##"if value < {min}{typ} || {max}{typ} < value {{ return Err(CanError::ParameterOutOfRange{{ min: {min}f64 , max: {max}f64 }}); }}"##,
385+
r##"if value < {min}_{typ} || {max}_{typ} < value {{ return Err(CanError::ParameterOutOfRange{{ min: {min}_f64 , max: {max}_f64 }}); }}"##,
386386
typ = signal_to_rust_type(&signal),
387387
min = signal.min(),
388388
max = signal.max(),

testing/can-messages/src/messages.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ impl Foo {
9292
#[inline(always)]
9393
pub fn set_voltage(&mut self, value: f32) -> Result<(), CanError> {
9494
#[cfg(feature = "range_checked")]
95-
if value < 0f32 || 63.9990234375f32 < value {
95+
if value < 0_f32 || 63.9990234375_f32 < value {
9696
return Err(CanError::ParameterOutOfRange {
97-
min: 0f64,
98-
max: 63.9990234375f64,
97+
min: 0_f64,
98+
max: 63.9990234375_f64,
9999
});
100100
}
101101
let factor = 0.000976562_f32;
@@ -140,10 +140,10 @@ impl Foo {
140140
#[inline(always)]
141141
pub fn set_current(&mut self, value: f32) -> Result<(), CanError> {
142142
#[cfg(feature = "range_checked")]
143-
if value < -2048f32 || 2047.9375f32 < value {
143+
if value < -2048_f32 || 2047.9375_f32 < value {
144144
return Err(CanError::ParameterOutOfRange {
145-
min: -2048f64,
146-
max: 2047.9375f64,
145+
min: -2048_f64,
146+
max: 2047.9375_f64,
147147
});
148148
}
149149
let factor = 0.0625_f32;
@@ -230,10 +230,10 @@ impl Bar {
230230
#[inline(always)]
231231
pub fn set_one(&mut self, value: u8) -> Result<(), CanError> {
232232
#[cfg(feature = "range_checked")]
233-
if value < 0u8 || 3u8 < value {
233+
if value < 0_u8 || 3_u8 < value {
234234
return Err(CanError::ParameterOutOfRange {
235-
min: 0f64,
236-
max: 3f64,
235+
min: 0_f64,
236+
max: 3_f64,
237237
});
238238
}
239239
let start_bit = 15;
@@ -274,10 +274,10 @@ impl Bar {
274274
#[inline(always)]
275275
pub fn set_two(&mut self, value: f32) -> Result<(), CanError> {
276276
#[cfg(feature = "range_checked")]
277-
if value < 0f32 || 100f32 < value {
277+
if value < 0_f32 || 100_f32 < value {
278278
return Err(CanError::ParameterOutOfRange {
279-
min: 0f64,
280-
max: 100f64,
279+
min: 0_f64,
280+
max: 100_f64,
281281
});
282282
}
283283
let factor = 0.39_f32;
@@ -326,10 +326,10 @@ impl Bar {
326326
#[inline(always)]
327327
pub fn set_three(&mut self, value: u8) -> Result<(), CanError> {
328328
#[cfg(feature = "range_checked")]
329-
if value < 0u8 || 7u8 < value {
329+
if value < 0_u8 || 7_u8 < value {
330330
return Err(CanError::ParameterOutOfRange {
331-
min: 0f64,
332-
max: 7f64,
331+
min: 0_f64,
332+
max: 7_f64,
333333
});
334334
}
335335
let start_bit = 13;
@@ -374,10 +374,10 @@ impl Bar {
374374
#[inline(always)]
375375
pub fn set_four(&mut self, value: u8) -> Result<(), CanError> {
376376
#[cfg(feature = "range_checked")]
377-
if value < 0u8 || 3u8 < value {
377+
if value < 0_u8 || 3_u8 < value {
378378
return Err(CanError::ParameterOutOfRange {
379-
min: 0f64,
380-
max: 3f64,
379+
min: 0_f64,
380+
max: 3_f64,
381381
});
382382
}
383383
let start_bit = 10;
@@ -432,9 +432,9 @@ pub enum CanError {
432432
/// Signal parameter is not within the range
433433
/// defined in the dbc
434434
ParameterOutOfRange {
435-
/// Minimum value defined in DBC
435+
/// Minimum value defined in DBC for signal
436436
min: f64,
437-
/// Maximum value defined in DBC
437+
/// Maximum value defined in DBC for signal
438438
max: f64,
439439
},
440440
InvalidPayloadSize,

0 commit comments

Comments
 (0)