Skip to content

Commit 39c8464

Browse files
committed
avoid unnecessary match block
1 parent 20a062e commit 39c8464

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pulse-binding/src/context/introspect.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,13 +1409,9 @@ fn send_message_to_object_cb_proxy(_: *mut ContextInternal, success: i32, respon
14091409
_ => true,
14101410
};
14111411
let _ = std::panic::catch_unwind(|| {
1412-
let r = match response.is_null() {
1413-
true => None,
1414-
false => {
1415-
let tmp = unsafe { CStr::from_ptr(response) };
1416-
Some(tmp.to_string_lossy().into_owned())
1417-
},
1418-
};
1412+
let r = response.is_null().then(|| {
1413+
unsafe { CStr::from_ptr(response) }.to_string_lossy().into_owned()
1414+
});
14191415
// Note, destroys closure callback after use - restoring outer box means it gets dropped
14201416
let mut callback = get_su_callback::<dyn FnMut(bool, Option<String>)>(userdata);
14211417
(callback)(success_actual, r);

0 commit comments

Comments
 (0)