swift-bridge icon indicating copy to clipboard operation
swift-bridge copied to clipboard

Clippy finds clippy::unnecessary-cast

Open bes opened this issue 1 year ago • 0 comments

Clippy complains:

error: casting raw pointers to the same type and constness is unnecessary (`*mut my_mod::FfiThing` -> `*mut my_mod::FfiThing`)

For this declaration:

#[swift_bridge::bridge]
mod ffi {

    // ...

    extern "Rust" {
        type FfiThing;

        #[swift_bridge(swift_name = "a")]
        fn a(&self) -> Option<FfiX>;

        #[swift_bridge(swift_name = "b")]
        fn b(&self) -> Option<FfiY>;
    }

    // ...
}

pub struct FfiThing {
    a: Option<FfiTypeA>,
    b: Option<FfiTypeB>,
}

impl FfiViewport {
    fn a(&self) -> Option<FfiTypeA> {
        self.a.clone()
    }
    fn b(&self) -> Option<FfiTypeB> {
        self.b.clone()
    }
}

bes avatar Sep 10 '23 18:09 bes