Skip to content

Commit 5da50a2

Browse files
Add a comment to denote why unwrap is safe
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
1 parent e4dd176 commit 5da50a2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rclrs/src/parameter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ impl ParameterStorage {
469469
ParameterKind::DoubleArray => ParameterType::PARAMETER_DOUBLE_ARRAY,
470470
ParameterKind::StringArray => ParameterType::PARAMETER_STRING_ARRAY,
471471
ParameterKind::Dynamic => match &s.value {
472+
// Unwraps here are safe because None will only be returned if the RwLock is
473+
// poisoned, but it is only written in internal set(value) calls that have no
474+
// way to panic.
472475
DeclaredValue::Mandatory(v) => v.read().unwrap().rcl_parameter_type(),
473476
DeclaredValue::Optional(v) => v
474477
.read()

0 commit comments

Comments
 (0)