Skip to content

Commit dc5194c

Browse files
🎨 zb: Remove redundant downcast checks
These downcasts are already validated at construction time and would just panic either way, so they serve no purpose.
1 parent 489b0f1 commit dc5194c

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

‎zbus/src/object_server/interface/interface_ref.rs‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ where
2525
pub async fn get(&self) -> InterfaceDeref<'_, I> {
2626
let iface = self.lock.read().await;
2727

28-
iface
29-
.downcast_ref::<I>()
30-
.expect("Unexpected interface type");
31-
3228
InterfaceDeref {
3329
iface,
3430
phantom: PhantomData,
@@ -80,14 +76,7 @@ where
8076
/// # Ok::<_, Box<dyn Error + Send + Sync>>(())
8177
/// ```
8278
pub async fn get_mut(&self) -> InterfaceDerefMut<'_, I> {
83-
let mut iface = self.lock.write().await;
84-
85-
iface
86-
.downcast_ref::<I>()
87-
.expect("Unexpected interface type");
88-
iface
89-
.downcast_mut::<I>()
90-
.expect("Unexpected interface type");
79+
let iface = self.lock.write().await;
9180

9281
InterfaceDerefMut {
9382
iface,

0 commit comments

Comments
 (0)